1: | <?php |
2: | namespace duyplus\tmdbapi\classes\data; |
3: | |
4: | use duyplus\tmdbapi\classes\data\Movie; |
5: | |
6: | /** |
7: | * This class handles all the data you can get from the api Configuration |
8: | * |
9: | * @package TMDB_V3_API_PHP |
10: | * @author Alvaro Octal |
11: | * @version 0.7 |
12: | * @date 20/01/2015 |
13: | * @updated 31/12/2024 |
14: | * @link https://github.com/duyplus/tmdbapi |
15: | * @copyright Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php) |
16: | */ |
17: | |
18: | class Company |
19: | { |
20: | //------------------------------------------------------------------------------ |
21: | // Class Variables |
22: | //------------------------------------------------------------------------------ |
23: | |
24: | private $_data; |
25: | |
26: | /** |
27: | * Construct Class |
28: | * |
29: | * @param array $data An array with the data of a Company |
30: | */ |
31: | public function __construct($data) |
32: | { |
33: | $this->_data = $data; |
34: | } |
35: | |
36: | //------------------------------------------------------------------------------ |
37: | // Get Variables |
38: | //------------------------------------------------------------------------------ |
39: | |
40: | /** |
41: | * Get the Company's name |
42: | * |
43: | * @return string |
44: | */ |
45: | public function getName() |
46: | { |
47: | return $this->_data['name']; |
48: | } |
49: | |
50: | /** |
51: | * Get the Company's id |
52: | * |
53: | * @return int |
54: | */ |
55: | public function getID() |
56: | { |
57: | return $this->_data['id']; |
58: | } |
59: | |
60: | /** |
61: | * Get the Company's description |
62: | * |
63: | * @return string |
64: | */ |
65: | public function getDescription() |
66: | { |
67: | return $this->_data['description']; |
68: | } |
69: | |
70: | /** |
71: | * Get the Company's headquearters |
72: | * |
73: | * @return string |
74: | */ |
75: | public function getHeadquarters() |
76: | { |
77: | return $this->_data['headquarters']; |
78: | } |
79: | |
80: | /** |
81: | * Get the Company's homepage |
82: | * |
83: | * @return string |
84: | */ |
85: | public function getHomepage() |
86: | { |
87: | return $this->_data['homepage']; |
88: | } |
89: | |
90: | /** |
91: | * Get the Company's logo |
92: | * |
93: | * @return string |
94: | */ |
95: | public function getLogo() |
96: | { |
97: | return $this->_data['logo_path']; |
98: | } |
99: | |
100: | /** |
101: | * Get the Company's parent company id |
102: | * |
103: | * @return int |
104: | */ |
105: | public function getParentCompanyID() |
106: | { |
107: | return $this->_data['parent_company']; |
108: | } |
109: | |
110: | /** |
111: | * Get the Company's Movies |
112: | * |
113: | * @return Movie[] |
114: | */ |
115: | public function getMovies() |
116: | { |
117: | $movies = array(); |
118: | foreach ($this->_data['movies']['results'] as $data) { |
119: | $movies[] = new Movie($data); |
120: | } |
121: | return $movies; |
122: | } |
123: | |
124: | /** |
125: | * Get Generic.<br> |
126: | * Get a item of the array, you should not get used to use this, better use specific get's. |
127: | * |
128: | * @param string $item The item of the $data array you want |
129: | * @return array |
130: | */ |
131: | public function get($item = '') |
132: | { |
133: | return (empty($item)) ? $this->_data : $this->_data[$item]; |
134: | } |
135: | |
136: | //------------------------------------------------------------------------------ |
137: | // Export |
138: | //------------------------------------------------------------------------------ |
139: | |
140: | /** |
141: | * Get the JSON representation of the Movie |
142: | * |
143: | * @return string |
144: | */ |
145: | public function getJSON() |
146: | { |
147: | return json_encode($this->_data, JSON_PRETTY_PRINT); |
148: | } |
149: | } |
150: | ?> |