| @@ -42,7 +42,7 @@ discard block | ||
| 42 | 42 | * @return bool | 
| 43 | 43 | */ | 
| 44 | 44 |      public function isSuccessful() { | 
| 45 | - if($this->info['http_code'] === 200) | |
| 45 | + if ($this->info['http_code'] === 200) | |
| 46 | 46 | return true; | 
| 47 | 47 | else return false; | 
| 48 | 48 | } | 
| @@ -55,8 +55,8 @@ discard block | ||
| 55 | 55 | */ | 
| 56 | 56 |      public function throwException() { | 
| 57 | 57 | // Unauthorized | 
| 58 | -        if($this->info['http_code'] === 401) { | |
| 59 | -            if($this->name == 'login') { | |
| 58 | +        if ($this->info['http_code'] === 401) { | |
| 59 | +            if ($this->name == 'login') { | |
| 60 | 60 |                  throw new TVDBUnauthorizedException('401: Unable to retrieve a TVDB token with the given details. Check your config.'); | 
| 61 | 61 | } | 
| 62 | 62 |              else { | 
| @@ -67,23 +67,23 @@ discard block | ||
| 67 | 67 | } | 
| 68 | 68 | } | 
| 69 | 69 | // Not found | 
| 70 | -        else if($this->info['http_code'] === 404) { | |
| 71 | -            if($this->name == 'get_series') { | |
| 70 | +        else if ($this->info['http_code'] === 404) { | |
| 71 | +            if ($this->name == 'get_series') { | |
| 72 | 72 |                  throw new TVDBNotFoundException('404: Unable to find the series - ' . $this->info['url']); | 
| 73 | 73 | } | 
| 74 | -            else if($this->name == 'get_series_actors') { | |
| 74 | +            else if ($this->name == 'get_series_actors') { | |
| 75 | 75 |                  throw new TVDBNotFoundException('404: Unable to find the actors - ' . $this->info['url']); | 
| 76 | 76 | } | 
| 77 | -            else if($this->name == 'get_series_episodes') { | |
| 77 | +            else if ($this->name == 'get_series_episodes') { | |
| 78 | 78 |                  throw new TVDBNotFoundException('404: Unable to find the episodes - ' . $this->info['url']); | 
| 79 | 79 | } | 
| 80 | -            else if($this->name == 'get_episode') { | |
| 80 | +            else if ($this->name == 'get_episode') { | |
| 81 | 81 |                  throw new TVDBNotFoundException('404: Unable to find the episode - ' . $this->info['url']); | 
| 82 | 82 | } | 
| 83 | 83 | // Generic 404 exception | 
| 84 | 84 | // We're ignoring 'search_series' because this API endpoint returns 404 | 
| 85 | 85 | // .. when there are no search results - we don't want that. | 
| 86 | -            else if($this->name != 'search_series') { | |
| 86 | +            else if ($this->name != 'search_series') { | |
| 87 | 87 |                  throw new TVDBNotFoundException('404: Not found. ' . $this->info['url']); | 
| 88 | 88 | } | 
| 89 | 89 | } | 
| @@ -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,11 +179,11 @@ 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 | $returnData = []; | 
| 185 | 185 | |
| 186 | - foreach($response->json()->data as $episodeData) | |
| 186 | + foreach ($response->json()->data as $episodeData) | |
| 187 | 187 | $returnData[] = new Episode($episodeData); | 
| 188 | 188 | |
| 189 | 189 | return new EpisodeCollection($page, $returnData); | 
| @@ -206,7 +206,7 @@ discard block | ||
| 206 | 206 | 'name' => 'get_episode' | 
| 207 | 207 | ]); | 
| 208 | 208 | |
| 209 | - if(!$response->isSuccessful()) $response->throwException(); | |
| 209 | + if (!$response->isSuccessful()) $response->throwException(); | |
| 210 | 210 | |
| 211 | 211 | return new Episode($response->json()->data); | 
| 212 | 212 | } | 
| @@ -220,7 +220,7 @@ discard block | ||
| 220 | 220 | */ | 
| 221 | 221 |      public static function getToken() { | 
| 222 | 222 | // Try to to refresh the cached token if there is one | 
| 223 | -        if(Cache::has(self::TOKEN_CACHE_KEY)) { | |
| 223 | +        if (Cache::has(self::TOKEN_CACHE_KEY)) { | |
| 224 | 224 | return Cache::get(self::TOKEN_CACHE_KEY); | 
| 225 | 225 | } | 
| 226 | 226 | |
| @@ -240,7 +240,7 @@ discard block | ||
| 240 | 240 | ]); | 
| 241 | 241 | |
| 242 | 242 | // Login may have failed | 
| 243 | - if(!$loginResponse->isSuccessful()) $loginResponse->throwException(); | |
| 243 | + if (!$loginResponse->isSuccessful()) $loginResponse->throwException(); | |
| 244 | 244 | |
| 245 | 245 | // Successfully logged in | 
| 246 | 246 | $token = $loginResponse->json()->token; | 
| @@ -263,7 +263,7 @@ discard block | ||
| 263 | 263 | $url = $options['url']; | 
| 264 | 264 | |
| 265 | 265 | // Add URL query params | 
| 266 | - if(isset($options['query'])) | |
| 266 | + if (isset($options['query'])) | |
| 267 | 267 | $url .= '?' . http_build_query($options['query']); | 
| 268 | 268 | |
| 269 | 269 | // Initialize handle | 
| @@ -275,13 +275,13 @@ discard block | ||
| 275 | 275 | // Add authentication header | 
| 276 | 276 | $usedToken = null; | 
| 277 | 277 | |
| 278 | -        if(isset($options['auth']) && $options['auth'] === true) { | |
| 278 | +        if (isset($options['auth']) && $options['auth'] === true) { | |
| 279 | 279 | $usedToken = self::getToken(); | 
| 280 | 280 | $requestHeaders[] = 'Authorization: ' . 'Bearer ' . $usedToken; | 
| 281 | 281 | } | 
| 282 | 282 | |
| 283 | 283 | // Add postfields | 
| 284 | -        if(isset($options['postfields'])) { | |
| 284 | +        if (isset($options['postfields'])) { | |
| 285 | 285 | curl_setopt($curlHandle, CURLOPT_POSTFIELDS, json_encode($options['postfields'])); | 
| 286 | 286 | } | 
| 287 | 287 | |
| @@ -24,7 +24,7 @@ | ||
| 24 | 24 | $this->imdbId = (strlen($data->imdbId)) ? $data->imdbId : null; | 
| 25 | 25 | $this->name = $data->episodeName; | 
| 26 | 26 | |
| 27 | - if($data->filename) | |
| 27 | + if ($data->filename) | |
| 28 | 28 | $this->image = TVDB::IMAGE_URL_PREFIX . $data->filename; | 
| 29 | 29 | else | 
| 30 | 30 | $this->image = null; | 
| @@ -43,7 +43,7 @@ | ||
| 43 | 43 | |
| 44 | 44 | /** Methods from interface ArrayAccess */ | 
| 45 | 45 |      public function offsetSet($offset, $value) { | 
| 46 | -        if(is_null($offset)) { | |
| 46 | +        if (is_null($offset)) { | |
| 47 | 47 | $this->episodes[] = $value; | 
| 48 | 48 |          } else { | 
| 49 | 49 | $this->episodes[$offset] = $value; |