@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * This file is part of the Tmdb package. |
| 4 | 4 | * |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * This file is part of the Tmdb package. |
| 4 | 4 | * |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * This file is part of the Tmdb package. |
| 4 | 4 | * |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * This file is part of the Tmdb package. |
| 4 | 4 | * |
@@ -162,15 +162,15 @@ |
||
| 162 | 162 | protected function sendRequest(string $method, string $url, array $form_params = array()) : ?\stdClass |
| 163 | 163 | { |
| 164 | 164 | switch ($method) { |
| 165 | - case 'GET': |
|
| 165 | + case 'GET': |
|
| 166 | 166 | $res = $this->http_request->getResponse($url); |
| 167 | - break; |
|
| 168 | - case 'POST': |
|
| 167 | + break; |
|
| 168 | + case 'POST': |
|
| 169 | 169 | $res = $this->http_request->postResponse($url, [], $form_params); |
| 170 | - break; |
|
| 171 | - case 'DELETE': |
|
| 170 | + break; |
|
| 171 | + case 'DELETE': |
|
| 172 | 172 | $res = $this->http_request->deleteResponse($url); |
| 173 | - break; |
|
| 173 | + break; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | if (empty($res->getBody())) |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | 4 | * This file is part of the Tmdb package. |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | public function checkOptions(array $options) : array |
| 238 | 238 | { |
| 239 | - $params = []; |
|
| 239 | + $params = []; |
|
| 240 | 240 | // Set default options |
| 241 | 241 | // $params['language'] = $this->language; |
| 242 | 242 | // $params['include_adult'] = $this->include_adult; |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | default: |
| 314 | 314 | throw new IncorrectParamException; |
| 315 | 315 | } |
| 316 | - return 'created_at.'.$direction; |
|
| 316 | + return 'created_at.' . $direction; |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
@@ -161,7 +161,8 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | protected function sendRequest(string $method, string $url, array $form_params = array()) : ?\stdClass |
| 163 | 163 | { |
| 164 | - switch ($method) { |
|
| 164 | + switch ($method) |
|
| 165 | + { |
|
| 165 | 166 | case 'GET': |
| 166 | 167 | $res = $this->http_request->getResponse($url); |
| 167 | 168 | break; |
@@ -179,7 +180,8 @@ discard block |
||
| 179 | 180 | throw new ServerErrorException(); |
| 180 | 181 | } |
| 181 | 182 | $response = json_decode($res->getBody()); |
| 182 | - if (empty($response)) { |
|
| 183 | + if (empty($response)) |
|
| 184 | + { |
|
| 183 | 185 | $this->logger->error('Request Body can not be decode', array('method' => $method, 'url' => $url, 'form_params' => $form_params)); |
| 184 | 186 | throw new ServerErrorException(); |
| 185 | 187 | } |
@@ -216,14 +218,18 @@ discard block |
||
| 216 | 218 | */ |
| 217 | 219 | public function getConfiguration() : \stdClass |
| 218 | 220 | { |
| 219 | - try { |
|
| 221 | + try |
|
| 222 | + { |
|
| 220 | 223 | $this->logger->debug('Start getting configuration'); |
| 221 | - if (is_null($this->configuration)) { |
|
| 224 | + if (is_null($this->configuration)) |
|
| 225 | + { |
|
| 222 | 226 | $this->logger->debug('No configuration found, sending HTTP request to get it'); |
| 223 | 227 | $this->configuration = $this->getRequest('configuration'); |
| 224 | 228 | } |
| 225 | 229 | return $this->configuration; |
| 226 | - } catch (TmdbException $ex) { |
|
| 230 | + } |
|
| 231 | + catch (TmdbException $ex) |
|
| 232 | + { |
|
| 227 | 233 | throw $ex; |
| 228 | 234 | } |
| 229 | 235 | } |
@@ -242,8 +248,10 @@ discard block |
||
| 242 | 248 | // $params['include_adult'] = $this->include_adult; |
| 243 | 249 | // $params['page'] = $this->page; |
| 244 | 250 | // Check options |
| 245 | - foreach ($options as $key => $value) { |
|
| 246 | - switch ($key) { |
|
| 251 | + foreach ($options as $key => $value) |
|
| 252 | + { |
|
| 253 | + switch ($key) |
|
| 254 | + { |
|
| 247 | 255 | case 'year': |
| 248 | 256 | $params[$key] = $this->checkYear($value); |
| 249 | 257 | break; |
@@ -291,7 +299,8 @@ discard block |
||
| 291 | 299 | private function checkLanguage(string $language) : string |
| 292 | 300 | { |
| 293 | 301 | $check = preg_match("#([a-z]{2})-([A-Z]{2})#", $language); |
| 294 | - if ($check === 0 || $check === false) { |
|
| 302 | + if ($check === 0 || $check === false) |
|
| 303 | + { |
|
| 295 | 304 | $this->logger->error('Incorrect language param option', array('language' => $language)); |
| 296 | 305 | throw new IncorrectParamException; |
| 297 | 306 | } |
@@ -306,7 +315,8 @@ discard block |
||
| 306 | 315 | */ |
| 307 | 316 | private function checkSort(string $direction) : string |
| 308 | 317 | { |
| 309 | - switch ($direction) { |
|
| 318 | + switch ($direction) |
|
| 319 | + { |
|
| 310 | 320 | case 'asc': |
| 311 | 321 | case 'desc': |
| 312 | 322 | break; |
@@ -332,7 +342,8 @@ discard block |
||
| 332 | 342 | */ |
| 333 | 343 | public function __get(string $name) : string |
| 334 | 344 | { |
| 335 | - switch ($name) { |
|
| 345 | + switch ($name) |
|
| 346 | + { |
|
| 336 | 347 | case 'url': |
| 337 | 348 | return $this->$name; |
| 338 | 349 | default: |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * This file is part of the Tmdb package. |
| 4 | 4 | * |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * This file is part of the Tmdb package. |
| 4 | 4 | * |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | /** |
| 3 | 3 | * This file is part of the Tmdb package. |
| 4 | 4 | * |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | 4 | * This file is part of the Tmdb package. |