1: | <?php |
2: | namespace Duyplus\TMDBApi\Classes\Config; |
3: | |
4: | class APIConfiguration |
5: | { |
6: | //------------------------------------------------------------------------------ |
7: | // Class Variables |
8: | //------------------------------------------------------------------------------ |
9: | |
10: | private $crawl; |
11: | |
12: | /** |
13: | * Construct Class |
14: | * |
15: | * @param array $data An array with the data of a Configuration |
16: | */ |
17: | public function __construct($data) |
18: | { |
19: | $this->crawl = $data; |
20: | } |
21: | |
22: | //------------------------------------------------------------------------------ |
23: | // Get Variables |
24: | //------------------------------------------------------------------------------ |
25: | |
26: | /** |
27: | * Get the Configuration's base URL for images |
28: | * |
29: | * @return string |
30: | */ |
31: | public function getImageBaseURL() |
32: | { |
33: | return $this->crawl['images']['base_url']; |
34: | } |
35: | |
36: | /** |
37: | * Get the Configuration's secure base URL for images |
38: | * |
39: | * @return string |
40: | */ |
41: | public function getSecureImageBaseURL() |
42: | { |
43: | return $this->crawl['images']['secure_base_url']; |
44: | } |
45: | |
46: | /** |
47: | * Get the Configuration's list of sizes for backdrops |
48: | * |
49: | * @return string[] |
50: | */ |
51: | public function getBackdropSizes() |
52: | { |
53: | return $this->crawl['images']['backdrop_sizes']; |
54: | } |
55: | |
56: | /** |
57: | * Get the Configuration's list of sizes for logos |
58: | * |
59: | * @return string[] |
60: | */ |
61: | public function getLogoSizes() |
62: | { |
63: | return $this->crawl['images']['logo_sizes']; |
64: | } |
65: | |
66: | /** |
67: | * Get the Configuration's list of sizes for posters |
68: | * |
69: | * @return string[] |
70: | */ |
71: | public function getPosterSizes() |
72: | { |
73: | return $this->crawl['images']['poster_sizes']; |
74: | } |
75: | |
76: | /** |
77: | * Get the Configuration's list of sizes for profiles |
78: | * |
79: | * @return string[] |
80: | */ |
81: | public function getProfileSizes() |
82: | { |
83: | return $this->crawl['images']['profile_sizes']; |
84: | } |
85: | |
86: | /** |
87: | * Get the Configuration's list of sizes for stills |
88: | * |
89: | * @return string[] |
90: | */ |
91: | public function getStillSizes() |
92: | { |
93: | return $this->crawl['images']['still_sizes']; |
94: | } |
95: | |
96: | /** |
97: | * Get Generic.<br> |
98: | * Get a item of the array, you should not get used to use this, better use specific get's. |
99: | * |
100: | * @param string $item The item of the $data array you want |
101: | * @return array |
102: | */ |
103: | public function get($item = '') |
104: | { |
105: | return (empty($item)) ? $this->crawl : $this->crawl[$item]; |
106: | } |
107: | |
108: | //------------------------------------------------------------------------------ |
109: | // Export |
110: | //------------------------------------------------------------------------------ |
111: | |
112: | /** |
113: | * Get the JSON representation of the Configuration |
114: | * |
115: | * @return string |
116: | */ |
117: | public function getJSON() |
118: | { |
119: | return json_encode($this->crawl, JSON_PRETTY_PRINT); |
120: | } |
121: | } |