1: <?php
2: namespace duyplus\tmdbapi\classes\config;
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 APIConfiguration
17: {
18:
19: //------------------------------------------------------------------------------
20: // Class Variables
21: //------------------------------------------------------------------------------
22:
23: private $_data;
24:
25: /**
26: * Construct Class
27: *
28: * @param array $data An array with the data of a Configuration
29: */
30: public function __construct($data)
31: {
32: $this->_data = $data;
33: }
34:
35: //------------------------------------------------------------------------------
36: // Get Variables
37: //------------------------------------------------------------------------------
38:
39: /**
40: * Get the Configuration's base URL for images
41: *
42: * @return string
43: */
44: public function getImageBaseURL()
45: {
46: return $this->_data['images']['base_url'];
47: }
48:
49: /**
50: * Get the Configuration's secure base URL for images
51: *
52: * @return string
53: */
54: public function getSecureImageBaseURL()
55: {
56: return $this->_data['images']['secure_base_url'];
57: }
58:
59: /**
60: * Get the Configuration's list of sizes for backdrops
61: *
62: * @return string[]
63: */
64: public function getBackdropSizes()
65: {
66: return $this->_data['images']['backdrop_sizes'];
67: }
68:
69: /**
70: * Get the Configuration's list of sizes for logos
71: *
72: * @return string[]
73: */
74: public function getLogoSizes()
75: {
76: return $this->_data['images']['logo_sizes'];
77: }
78:
79: /**
80: * Get the Configuration's list of sizes for posters
81: *
82: * @return string[]
83: */
84: public function getPosterSizes()
85: {
86: return $this->_data['images']['poster_sizes'];
87: }
88:
89: /**
90: * Get the Configuration's list of sizes for profiles
91: *
92: * @return string[]
93: */
94: public function getProfileSizes()
95: {
96: return $this->_data['images']['profile_sizes'];
97: }
98:
99: /**
100: * Get the Configuration's list of sizes for stills
101: *
102: * @return string[]
103: */
104: public function getStillSizes()
105: {
106: return $this->_data['images']['still_sizes'];
107: }
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
116: */
117: public function get($item = '')
118: {
119: return (empty($item)) ? $this->_data : $this->_data[$item];
120: }
121:
122: //------------------------------------------------------------------------------
123: // Export
124: //------------------------------------------------------------------------------
125:
126: /**
127: * Get the JSON representation of the Configuration
128: *
129: * @return string
130: */
131: public function getJSON()
132: {
133: return json_encode($this->_data, JSON_PRETTY_PRINT);
134: }
135: }
136: ?>