@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | // Format search query |
53 | 53 | $query = []; |
54 | 54 | |
55 | - if((is_array($options) && isset($options['title']))) |
|
55 | + if ((is_array($options) && isset($options['title']))) |
|
56 | 56 | $query['name'] = $options['title']; |
57 | - else if(is_string($options)) |
|
57 | + else if (is_string($options)) |
|
58 | 58 | $query['name'] = $options; |
59 | 59 | |
60 | - if(is_array($options) && isset($options['imdbId'])) $query['imdbId'] = $options['imdbId']; |
|
61 | - if(is_array($options) && isset($options['zap2itId'])) $query['zap2itId'] = $options['zap2itId']; |
|
60 | + if (is_array($options) && isset($options['imdbId'])) $query['imdbId'] = $options['imdbId']; |
|
61 | + if (is_array($options) && isset($options['zap2itId'])) $query['zap2itId'] = $options['zap2itId']; |
|
62 | 62 | |
63 | 63 | $response = self::request([ |
64 | 64 | 'method' => 'GET', |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | 'name' => 'search_series' |
69 | 69 | ]); |
70 | 70 | |
71 | - if(!$response->isSuccessful()) $response->throwException(); |
|
71 | + if (!$response->isSuccessful()) $response->throwException(); |
|
72 | 72 | |
73 | 73 | $responseData = (isset($response->json()->data)) ? $response->json()->data : []; |
74 | 74 | $series = []; |
75 | 75 | |
76 | - foreach($responseData as $seriesData) |
|
76 | + foreach ($responseData as $seriesData) |
|
77 | 77 | $series[] = new Series($seriesData); |
78 | 78 | |
79 | 79 | return $series; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | 'name' => 'get_series' |
97 | 97 | ]); |
98 | 98 | |
99 | - if(!$response->isSuccessful()) $response->throwException(); |
|
99 | + if (!$response->isSuccessful()) $response->throwException(); |
|
100 | 100 | |
101 | 101 | return new Series($response->json()->data); |
102 | 102 | } |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | 'name' => 'get_series_actors' |
119 | 119 | ]); |
120 | 120 | |
121 | - if(!$response->isSuccessful()) $response->throwException(); |
|
121 | + if (!$response->isSuccessful()) $response->throwException(); |
|
122 | 122 | |
123 | 123 | $returnData = []; |
124 | 124 | |
125 | - foreach($response->json()->data as $actorData) |
|
125 | + foreach ($response->json()->data as $actorData) |
|
126 | 126 | $returnData[] = new Actor($actorData); |
127 | 127 | |
128 | 128 | return $returnData; |
@@ -146,11 +146,11 @@ discard block |
||
146 | 146 | 'name' => 'get_series_images' |
147 | 147 | ]); |
148 | 148 | |
149 | - if(!$response->isSuccessful()) $response->throwException(); |
|
149 | + if (!$response->isSuccessful()) $response->throwException(); |
|
150 | 150 | |
151 | 151 | $returnData = []; |
152 | 152 | |
153 | - foreach($response->json()->data as $imageData) |
|
153 | + foreach ($response->json()->data as $imageData) |
|
154 | 154 | $returnData[] = [ |
155 | 155 | 'resolution' => $imageData->resolution, |
156 | 156 | 'image' => self::IMAGE_URL_PREFIX . $imageData->fileName, |
@@ -179,13 +179,13 @@ discard block |
||
179 | 179 | 'name' => 'get_series_episodes' |
180 | 180 | ]); |
181 | 181 | |
182 | - if(!$response->isSuccessful()) $response->throwException(); |
|
182 | + if (!$response->isSuccessful()) $response->throwException(); |
|
183 | 183 | |
184 | 184 | $nextPage = $response->json()->links->next; |
185 | 185 | |
186 | 186 | $returnData = []; |
187 | 187 | |
188 | - foreach($response->json()->data as $episodeData) |
|
188 | + foreach ($response->json()->data as $episodeData) |
|
189 | 189 | $returnData[] = new Episode($episodeData); |
190 | 190 | |
191 | 191 | return new EpisodeCollection($page, $returnData, $nextPage); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | 'name' => 'get_episode' |
209 | 209 | ]); |
210 | 210 | |
211 | - if(!$response->isSuccessful()) $response->throwException(); |
|
211 | + if (!$response->isSuccessful()) $response->throwException(); |
|
212 | 212 | |
213 | 213 | return new Episode($response->json()->data); |
214 | 214 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | */ |
223 | 223 | public static function getToken() { |
224 | 224 | // Try to to refresh the cached token if there is one |
225 | - if(Cache::has(self::TOKEN_CACHE_KEY)) { |
|
225 | + if (Cache::has(self::TOKEN_CACHE_KEY)) { |
|
226 | 226 | return Cache::get(self::TOKEN_CACHE_KEY); |
227 | 227 | } |
228 | 228 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | ]); |
243 | 243 | |
244 | 244 | // Login may have failed |
245 | - if(!$loginResponse->isSuccessful()) $loginResponse->throwException(); |
|
245 | + if (!$loginResponse->isSuccessful()) $loginResponse->throwException(); |
|
246 | 246 | |
247 | 247 | // Successfully logged in |
248 | 248 | $token = $loginResponse->json()->token; |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $url = $options['url']; |
266 | 266 | |
267 | 267 | // Add URL query params |
268 | - if(isset($options['query'])) |
|
268 | + if (isset($options['query'])) |
|
269 | 269 | $url .= '?' . http_build_query($options['query']); |
270 | 270 | |
271 | 271 | // Initialize handle |
@@ -277,13 +277,13 @@ discard block |
||
277 | 277 | // Add authentication header |
278 | 278 | $usedToken = null; |
279 | 279 | |
280 | - if(isset($options['auth']) && $options['auth'] === true) { |
|
280 | + if (isset($options['auth']) && $options['auth'] === true) { |
|
281 | 281 | $usedToken = self::getToken(); |
282 | 282 | $requestHeaders[] = 'Authorization: ' . 'Bearer ' . $usedToken; |
283 | 283 | } |
284 | 284 | |
285 | 285 | // Add postfields |
286 | - if(isset($options['postfields'])) { |
|
286 | + if (isset($options['postfields'])) { |
|
287 | 287 | curl_setopt($curlHandle, CURLOPT_POSTFIELDS, json_encode($options['postfields'])); |
288 | 288 | } |
289 | 289 |