1: | <?php
|
2: | namespace duyplus\tmdbapi\classes\config;
|
3: |
|
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | |
12: | |
13: | |
14: |
|
15: |
|
16: | class Configuration
|
17: | {
|
18: |
|
19: |
|
20: |
|
21: |
|
22: |
|
23: | private $apikey = '';
|
24: | private $lang = 'en';
|
25: | private $timezone = 'Europe/Berlin';
|
26: | private $adult = false;
|
27: | private $debug = false;
|
28: |
|
29: | |
30: | |
31: |
|
32: | private $appender = [
|
33: | 'movie' => array('account_states', 'alternative_titles', 'credits', 'images', 'keywords', 'release_dates', 'videos', 'translations', 'similar', 'reviews', 'lists', 'changes', 'rating'),
|
34: | 'tvshow' => array('account_states', 'alternative_titles', 'changes', 'content_rating', 'credits', 'external_ids', 'images', 'keywords', 'rating', 'similar', 'translations', 'videos'),
|
35: | 'season' => array('changes', 'account_states', 'credits', 'external_ids', 'images', 'videos'),
|
36: | 'episode' => array('changes', 'account_states', 'credits', 'external_ids', 'images', 'rating', 'videos'),
|
37: | 'person' => array('movie_credits', 'tv_credits', 'combined_credits', 'external_ids', 'images', 'tagged_images', 'changes'),
|
38: | 'collection' => array('images'),
|
39: | 'company' => array('movies'),
|
40: | ];
|
41: |
|
42: |
|
43: |
|
44: |
|
45: |
|
46: | |
47: | |
48: | |
49: | |
50: |
|
51: | public function __construct($cnf = null)
|
52: | {
|
53: |
|
54: |
|
55: | if (!isset($cnf)) {
|
56: | require_once __DIR__ . '/../../configuration/Default.php';
|
57: | }
|
58: | $this->setAPIKey(isset($cnf['apikey']) ? $cnf['apikey'] : null);
|
59: | $this->setLang(isset($cnf['lang']) ? $cnf['lang'] : 'en');
|
60: | $this->setTimeZone(isset($cnf['timezone']) ? $cnf['timezone'] : 'UTC');
|
61: | $this->setAdult(isset($cnf['adult']) ? (bool) $cnf['adult'] : false);
|
62: | $this->setDebug(isset($cnf['debug']) ? (bool) $cnf['debug'] : false);
|
63: | }
|
64: |
|
65: |
|
66: |
|
67: |
|
68: |
|
69: |
|
70: | |
71: | |
72: | |
73: | |
74: |
|
75: | public function setAPIKey($apikey)
|
76: | {
|
77: | $this->apikey = $apikey;
|
78: | }
|
79: |
|
80: | |
81: | |
82: | |
83: | |
84: |
|
85: | public function setLang($lang)
|
86: | {
|
87: | $this->lang = $lang;
|
88: | }
|
89: |
|
90: | |
91: | |
92: | |
93: | |
94: |
|
95: | public function setTimeZone($timezone)
|
96: | {
|
97: | $this->timezone = $timezone;
|
98: | }
|
99: |
|
100: | |
101: | |
102: | |
103: | |
104: |
|
105: | public function setAdult($adult)
|
106: | {
|
107: | $this->adult = $adult;
|
108: | }
|
109: |
|
110: | |
111: | |
112: | |
113: | |
114: |
|
115: | public function setDebug($debug)
|
116: | {
|
117: | $this->debug = $debug;
|
118: | }
|
119: |
|
120: | |
121: | |
122: | |
123: | |
124: | |
125: |
|
126: | public function setAppender($appender, $type)
|
127: | {
|
128: | $this->appender[$type] = $appender;
|
129: | }
|
130: |
|
131: |
|
132: |
|
133: |
|
134: |
|
135: | |
136: | |
137: | |
138: | |
139: |
|
140: | public function getAPIKey()
|
141: | {
|
142: | return $this->apikey;
|
143: | }
|
144: |
|
145: | |
146: | |
147: | |
148: | |
149: |
|
150: | public function getLang()
|
151: | {
|
152: | return $this->lang;
|
153: | }
|
154: |
|
155: | |
156: | |
157: | |
158: | |
159: |
|
160: | public function getTimeZone()
|
161: | {
|
162: | return $this->timezone;
|
163: | }
|
164: |
|
165: | |
166: | |
167: | |
168: | |
169: |
|
170: | public function getAdult()
|
171: | {
|
172: | return ($this->adult) ? 'true' : 'false';
|
173: | }
|
174: |
|
175: | |
176: | |
177: | |
178: | |
179: |
|
180: | public function getDebug()
|
181: | {
|
182: | return $this->debug;
|
183: | }
|
184: |
|
185: | |
186: | |
187: | |
188: | |
189: |
|
190: | public function getAppender($type)
|
191: | {
|
192: | return $this->appender[$type];
|
193: | }
|
194: | }
|
195: |
|
196: | ?> |