1: | <?php |
2: | namespace Duyplus\TMDBApi\Classes\Jobs; |
3: | |
4: | class MovieJob |
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 MovieJob |
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 Movie's title |
32: | * |
33: | * @return string |
34: | */ |
35: | public function getMovieTitle() |
36: | { |
37: | return $this->crawl['title']; |
38: | } |
39: | |
40: | /** |
41: | * Get the Movie's id |
42: | * |
43: | * @return int |
44: | */ |
45: | public function getMovieID() |
46: | { |
47: | return $this->crawl['id']; |
48: | } |
49: | |
50: | /** |
51: | * Get the Movie's original title |
52: | * |
53: | * @return string |
54: | */ |
55: | public function getMovieOriginalTitle() |
56: | { |
57: | return $this->crawl['original_title']; |
58: | } |
59: | |
60: | /** |
61: | * Get the Movie's release date |
62: | * |
63: | * @return string |
64: | */ |
65: | public function getMovieReleaseDate() |
66: | { |
67: | return $this->crawl['release_date']; |
68: | } |
69: | |
70: | /** |
71: | * Get the Movie's poster |
72: | * |
73: | * @return string |
74: | */ |
75: | public function getPoster() |
76: | { |
77: | return $this->crawl['poster_path']; |
78: | } |
79: | |
80: | /** |
81: | * Get the Movie's job |
82: | * |
83: | * @return string |
84: | */ |
85: | public function getMovieJob() |
86: | { |
87: | return $this->crawl['job']; |
88: | } |
89: | |
90: | /** |
91: | * Get the Movie's department |
92: | * |
93: | * @return string |
94: | */ |
95: | public function getMovieDepartment() |
96: | { |
97: | return $this->crawl['department']; |
98: | } |
99: | |
100: | /** |
101: | * Get the Movie's overview |
102: | * |
103: | * @return string |
104: | */ |
105: | public function getMovieOverview() |
106: | { |
107: | return $this->crawl['overview']; |
108: | } |
109: | |
110: | /** |
111: | * Get Generic.<br> |
112: | * Get a item of the array, you should not get used to use this, better use specific get's. |
113: | * |
114: | * @param string $item The item of the $data array you want |
115: | * @return array|mixed|null Returns the entire data array, a specific item, or null if the item does not exist. |
116: | */ |
117: | public function get($item = '') |
118: | { |
119: | if (empty($item)) { |
120: | return $this->crawl; |
121: | } |
122: | if (array_key_exists($item, $this->crawl)) { |
123: | return $this->crawl[$item]; |
124: | } |
125: | return null; |
126: | } |
127: | |
128: | /** |
129: | * Get the JSON representation of the MovieJob |
130: | * |
131: | * @return string |
132: | */ |
133: | public function getJSON() |
134: | { |
135: | return json_encode($this->crawl, JSON_PRETTY_PRINT); |
136: | } |
137: | } |