@@ -61,10 +61,12 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | private function searchItem(string $item, string $query, array $options, string $result_class) : \Generator |
| 63 | 63 | { |
| 64 | - try { |
|
| 64 | + try |
|
| 65 | + { |
|
| 65 | 66 | $this->logger->debug('Starting search item', array('item' => $item, 'query' => $query, 'options' => $options, 'result_class' => $result_class)); |
| 66 | 67 | $query = trim($query); |
| 67 | - if (empty($query)) { |
|
| 68 | + if (empty($query)) |
|
| 69 | + { |
|
| 68 | 70 | $this->logger->error('Query param cannot be empty', array('item' => $item, 'query' => $query, 'options' => $options, 'result_class' => $result_class)); |
| 69 | 71 | throw new IncorrectParamException; |
| 70 | 72 | } |
@@ -77,7 +79,9 @@ discard block |
||
| 77 | 79 | $this->total_results = (int) $response->total_results; |
| 78 | 80 | |
| 79 | 81 | return $this->searchItemGenerator($response->results, $result_class); |
| 80 | - } catch (TmdbException $ex) { |
|
| 82 | + } |
|
| 83 | + catch (TmdbException $ex) |
|
| 84 | + { |
|
| 81 | 85 | throw $ex; |
| 82 | 86 | } |
| 83 | 87 | } |
@@ -90,7 +94,8 @@ discard block |
||
| 90 | 94 | private function searchItemGenerator(array $results, string $class) |
| 91 | 95 | { |
| 92 | 96 | $this->logger->debug('Starting search item generator', array('results' => $results, 'class' => $class)); |
| 93 | - foreach ($results as $result) { |
|
| 97 | + foreach ($results as $result) |
|
| 98 | + { |
|
| 94 | 99 | $element = new $class($this->tmdb, $result); |
| 95 | 100 | |
| 96 | 101 | yield $element; |
@@ -106,10 +111,13 @@ discard block |
||
| 106 | 111 | */ |
| 107 | 112 | public function movie(string $query, array $options = array()) : \Generator |
| 108 | 113 | { |
| 109 | - try { |
|
| 114 | + try |
|
| 115 | + { |
|
| 110 | 116 | $this->logger->debug('Starting search movie', array('query' => $query, 'options' => $options)); |
| 111 | 117 | return $this->searchItem('movie', $query, $options, Results\Movie::class); |
| 112 | - } catch (TmdbException $ex) { |
|
| 118 | + } |
|
| 119 | + catch (TmdbException $ex) |
|
| 120 | + { |
|
| 113 | 121 | throw $ex; |
| 114 | 122 | } |
| 115 | 123 | } |
@@ -123,10 +131,13 @@ discard block |
||
| 123 | 131 | */ |
| 124 | 132 | public function tvshow(string $query, array $options = array()) : \Generator |
| 125 | 133 | { |
| 126 | - try { |
|
| 134 | + try |
|
| 135 | + { |
|
| 127 | 136 | $this->logger->debug('Starting search tv show', array('query' => $query, 'options' => $options)); |
| 128 | 137 | return $this->searchItem('tv', $query, $options, Results\TVShow::class); |
| 129 | - } catch (TmdbException $ex) { |
|
| 138 | + } |
|
| 139 | + catch (TmdbException $ex) |
|
| 140 | + { |
|
| 130 | 141 | throw $ex; |
| 131 | 142 | } |
| 132 | 143 | } |
@@ -140,10 +151,13 @@ discard block |
||
| 140 | 151 | */ |
| 141 | 152 | public function collection(string $query, array $options = array()) : \Generator |
| 142 | 153 | { |
| 143 | - try { |
|
| 154 | + try |
|
| 155 | + { |
|
| 144 | 156 | $this->logger->debug('Starting search collection', array('query' => $query, 'options' => $options)); |
| 145 | 157 | return $this->searchItem('collection', $query, $options, Results\Collection::class); |
| 146 | - } catch (TmdbException $ex) { |
|
| 158 | + } |
|
| 159 | + catch (TmdbException $ex) |
|
| 160 | + { |
|
| 147 | 161 | throw $ex; |
| 148 | 162 | } |
| 149 | 163 | } |
@@ -157,10 +171,13 @@ discard block |
||
| 157 | 171 | */ |
| 158 | 172 | public function people(string $query, array $options = array()) : \Generator |
| 159 | 173 | { |
| 160 | - try { |
|
| 174 | + try |
|
| 175 | + { |
|
| 161 | 176 | $this->logger->debug('Starting search people', array('query' => $query, 'options' => $options)); |
| 162 | 177 | return $this->searchItem('person', $query, $options, Results\People::class); |
| 163 | - } catch (TmdbException $ex) { |
|
| 178 | + } |
|
| 179 | + catch (TmdbException $ex) |
|
| 180 | + { |
|
| 164 | 181 | throw $ex; |
| 165 | 182 | } |
| 166 | 183 | } |
@@ -174,10 +191,13 @@ discard block |
||
| 174 | 191 | */ |
| 175 | 192 | public function company(string $query, array $options = array()) : \Generator |
| 176 | 193 | { |
| 177 | - try { |
|
| 194 | + try |
|
| 195 | + { |
|
| 178 | 196 | $this->logger->debug('Starting search company', array('query' => $query, 'options' => $options)); |
| 179 | 197 | return $this->searchItem('company', $query, $options, Results\Company::class); |
| 180 | - } catch (TmdbException $ex) { |
|
| 198 | + } |
|
| 199 | + catch (TmdbException $ex) |
|
| 200 | + { |
|
| 181 | 201 | throw $ex; |
| 182 | 202 | } |
| 183 | 203 | } |
@@ -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 | * |
@@ -29,7 +29,8 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public function getPosterPath() : string |
| 31 | 31 | { |
| 32 | - if (isset($this->data->poster_path)) { |
|
| 32 | + if (isset($this->data->poster_path)) |
|
| 33 | + { |
|
| 33 | 34 | return $this->data->poster_path; |
| 34 | 35 | } |
| 35 | 36 | return ''; |
@@ -41,7 +42,8 @@ discard block |
||
| 41 | 42 | */ |
| 42 | 43 | public function getBackdropPath() : string |
| 43 | 44 | { |
| 44 | - if (isset($this->data->backdrop_path)) { |
|
| 45 | + if (isset($this->data->backdrop_path)) |
|
| 46 | + { |
|
| 45 | 47 | return $this->data->backdrop_path; |
| 46 | 48 | } |
| 47 | 49 | return ''; |
@@ -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 | * |
@@ -66,14 +66,17 @@ |
||
| 66 | 66 | */ |
| 67 | 67 | public function __construct(TmdbInterface $tmdb, int $item_id, array $options, string $item_name) |
| 68 | 68 | { |
| 69 | - try { |
|
| 69 | + try |
|
| 70 | + { |
|
| 70 | 71 | $this->id = $item_id; |
| 71 | 72 | $this->tmdb = $tmdb; |
| 72 | 73 | $this->logger = $tmdb->getLogger(); |
| 73 | 74 | $this->conf = $this->tmdb->getConfiguration(); |
| 74 | 75 | $this->params = $this->tmdb->checkOptions($options); |
| 75 | 76 | $this->data = $this->tmdb->getRequest($item_name . '/' . (int) $item_id, $this->params); |
| 76 | - } catch (TmdbException $ex) { |
|
| 77 | + } |
|
| 78 | + catch (TmdbException $ex) |
|
| 79 | + { |
|
| 77 | 80 | throw $ex; |
| 78 | 81 | } |
| 79 | 82 | } |
@@ -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 | * |
@@ -64,8 +64,10 @@ |
||
| 64 | 64 | |
| 65 | 65 | // Valid input object |
| 66 | 66 | $properties = get_object_vars($this); |
| 67 | - foreach (array_keys($properties) as $property) { |
|
| 68 | - if (!in_array($property, $this->property_blacklist) && !property_exists($result, $property)) { |
|
| 67 | + foreach (array_keys($properties) as $property) |
|
| 68 | + { |
|
| 69 | + if (!in_array($property, $this->property_blacklist) && !property_exists($result, $property)) |
|
| 70 | + { |
|
| 69 | 71 | throw new NotFoundException($property); |
| 70 | 72 | } |
| 71 | 73 | } |
@@ -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 | * |
@@ -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 | * |