1: <?php
2: namespace duyplus\tmdbapi\classes\data;
3:
4: /**
5: * This class handles all the data you can get from the api Configuration
6: *
7: * @package TMDB_V3_API_PHP
8: * @author Alvaro Octal
9: * @version 0.7
10: * @date 20/01/2015
11: * @updated 31/12/2024
12: * @link https://github.com/duyplus/tmdbapi
13: * @copyright Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)
14: */
15:
16: class Episode
17: {
18: //------------------------------------------------------------------------------
19: // Class Variables
20: //------------------------------------------------------------------------------
21:
22: private $_data;
23:
24: /**
25: * Construct Class
26: *
27: * @param array $data An array with the data of the Episode
28: */
29: public function __construct($data, $idTVShow = 0)
30: {
31: $this->_data = $data;
32: $this->_data['tvshow_id'] = $idTVShow;
33: }
34:
35: //------------------------------------------------------------------------------
36: // Get Variables
37: //------------------------------------------------------------------------------
38:
39: /**
40: * Get the episode's id
41: *
42: * @return int
43: */
44: public function getID()
45: {
46: return $this->_data['id'];
47: }
48:
49: /**
50: * Get the Episode's name
51: *
52: * @return string
53: */
54: public function getName()
55: {
56: return $this->_data['name'];
57: }
58:
59: /**
60: * Get the Season's TVShow id
61: *
62: * @return int
63: */
64: public function getTVShowID()
65: {
66: return $this->_data['tvshow_id'];
67: }
68:
69: /**
70: * Get the Season's number
71: *
72: * @return int
73: */
74: public function getSeasonNumber()
75: {
76: return $this->_data['season_number'];
77: }
78:
79: /**
80: * Get the Episode's number
81: *
82: * @return string
83: */
84: public function getEpisodeNumber()
85: {
86: return $this->_data['episode_number'];
87: }
88:
89: /**
90: * Get the Episode's Overview
91: *
92: * @return string
93: */
94: public function getOverview()
95: {
96: return $this->_data['overview'];
97: }
98:
99: /**
100: * Get the Seasons's Still
101: *
102: * @return string
103: */
104: public function getStill()
105: {
106: return $this->_data['still_path'];
107: }
108:
109: /**
110: * Get the Season's AirDate
111: *
112: * @return string
113: */
114: public function getAirDate()
115: {
116: return $this->_data['air_date'];
117: }
118:
119: /**
120: * Get the Episode's vote average
121: *
122: * @return int
123: */
124: public function getVoteAverage()
125: {
126: return $this->_data['vote_average'];
127: }
128:
129: /**
130: * Get the Episode's vote count
131: *
132: * @return int
133: */
134: public function getVoteCount()
135: {
136: return $this->_data['vote_count'];
137: }
138:
139: /**
140: * Get Generic.<br>
141: * Get a item of the array, you should not get used to use this, better use specific get's.
142: *
143: * @param string $item The item of the $data array you want
144: * @return array
145: */
146: public function get($item = '')
147: {
148: return (empty($item)) ? $this->_data : $this->_data[$item];
149: }
150:
151: //------------------------------------------------------------------------------
152: // Export
153: //------------------------------------------------------------------------------
154:
155: /**
156: * Get the JSON representation of the Episode
157: *
158: * @return string
159: */
160: public function getJSON()
161: {
162: return json_encode($this->_data, JSON_PRETTY_PRINT);
163: }
164: }
165: ?>