1: | <?php |
2: | namespace Duyplus\TMDBApi\Classes\Jobs; |
3: | |
4: | class TVShowJob |
5: | { |
6: | //------------------------------------------------------------------------------ |
7: | // Class Variables |
8: | //------------------------------------------------------------------------------ |
9: | |
10: | protected $crawl; |
11: | |
12: | /** |
13: | * Construct Class |
14: | * |
15: | * @param array $data An array with the data of a TVShowJob |
16: | * @param int|null $personId The person id |
17: | */ |
18: | public function __construct($data, $personId = null) |
19: | { |
20: | $this->crawl = $data; |
21: | if ($personId !== null) { |
22: | $this->crawl['person_id'] = $personId; |
23: | } |
24: | } |
25: | |
26: | //------------------------------------------------------------------------------ |
27: | // Get Variables |
28: | //------------------------------------------------------------------------------ |
29: | |
30: | /** |
31: | * Get the TVShow's title |
32: | * |
33: | * @return string |
34: | */ |
35: | public function getTVShowName() |
36: | { |
37: | return $this->crawl['name']; |
38: | } |
39: | |
40: | /** |
41: | * Get the TVShow's id |
42: | * |
43: | * @return int |
44: | */ |
45: | public function getTVShowID() |
46: | { |
47: | return $this->crawl['id']; |
48: | } |
49: | |
50: | /** |
51: | * Get the TVShow's original title |
52: | * |
53: | * @return string |
54: | */ |
55: | public function getTVShowOriginalTitle() |
56: | { |
57: | return $this->crawl['original_name']; |
58: | } |
59: | |
60: | /** |
61: | * Get the TVShow's release date |
62: | * |
63: | * @return string |
64: | */ |
65: | public function getTVShowFirstAirDate() |
66: | { |
67: | return $this->crawl['first_air_date']; |
68: | } |
69: | |
70: | /** |
71: | * Get the TVShow's poster |
72: | * |
73: | * @return string |
74: | */ |
75: | public function getPoster() |
76: | { |
77: | return $this->crawl['poster_path']; |
78: | } |
79: | |
80: | /** |
81: | * Get the TVShow's job |
82: | * |
83: | * @return string |
84: | */ |
85: | public function getTVShowJob() |
86: | { |
87: | return $this->crawl['job']; |
88: | } |
89: | |
90: | /** |
91: | * Get the TVShow's department |
92: | * |
93: | * @return string |
94: | */ |
95: | public function getTVShowDepartment() |
96: | { |
97: | return $this->crawl['department']; |
98: | } |
99: | |
100: | /** |
101: | * Get the TVShow's overview |
102: | * |
103: | * @return string |
104: | */ |
105: | public function getTVShowOverview() |
106: | { |
107: | return $this->crawl['overview']; |
108: | } |
109: | |
110: | /** |
111: | * Get the TVShow's episode count |
112: | * |
113: | * @return int |
114: | */ |
115: | public function getTVShowEpisodeCount() |
116: | { |
117: | return $this->crawl['episode_count']; |
118: | } |
119: | |
120: | /** |
121: | * Get Generic.<br> |
122: | * Get a item of the array, you should not get used to use this, better use specific get's. |
123: | * |
124: | * @param string $item The item of the $data array you want |
125: | * @return array|mixed|null Returns the entire data array, a specific item, or null if the item does not exist. |
126: | */ |
127: | public function get($item = '') |
128: | { |
129: | if (empty($item)) { |
130: | return $this->crawl; |
131: | } |
132: | if (array_key_exists($item, $this->crawl)) { |
133: | return $this->crawl[$item]; |
134: | } |
135: | return null; |
136: | } |
137: | |
138: | /** |
139: | * Get the JSON representation of the TVShowJob |
140: | * |
141: | * @return string |
142: | */ |
143: | public function getJSON() |
144: | { |
145: | return json_encode($this->crawl, JSON_PRETTY_PRINT); |
146: | } |
147: | } |