@@ -51,9 +51,12 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function getMovieList(array $options = array()) |
| 53 | 53 | { |
| 54 | - try { |
|
| 54 | + try |
|
| 55 | + { |
|
| 55 | 56 | return $this->getList('genre/movie/list', $options); |
| 56 | - } catch (TmdbException $ex) { |
|
| 57 | + } |
|
| 58 | + catch (TmdbException $ex) |
|
| 59 | + { |
|
| 57 | 60 | throw $ex; |
| 58 | 61 | } |
| 59 | 62 | } |
@@ -66,9 +69,12 @@ discard block |
||
| 66 | 69 | */ |
| 67 | 70 | public function getTVList(array $options = array()) |
| 68 | 71 | { |
| 69 | - try { |
|
| 72 | + try |
|
| 73 | + { |
|
| 70 | 74 | return $this->getList('genre/tv/list', $options); |
| 71 | - } catch (TmdbException $ex) { |
|
| 75 | + } |
|
| 76 | + catch (TmdbException $ex) |
|
| 77 | + { |
|
| 72 | 78 | throw $ex; |
| 73 | 79 | } |
| 74 | 80 | } |
@@ -82,17 +88,21 @@ discard block |
||
| 82 | 88 | */ |
| 83 | 89 | private function getList($type, array $options) |
| 84 | 90 | { |
| 85 | - try { |
|
| 91 | + try |
|
| 92 | + { |
|
| 86 | 93 | $params = $this->tmdb->checkOptions($options); |
| 87 | 94 | $response = $this->tmdb->sendRequest(new HttpClient(new \GuzzleHttp\Client()), $type, null, $params); |
| 88 | 95 | |
| 89 | 96 | $genres = []; |
| 90 | - if (isset($response->genres)) { |
|
| 97 | + if (isset($response->genres)) |
|
| 98 | + { |
|
| 91 | 99 | $genres = $response->genres; |
| 92 | 100 | } |
| 93 | 101 | |
| 94 | 102 | return $this->genreItemGenerator($genres); |
| 95 | - } catch (TmdbException $ex) { |
|
| 103 | + } |
|
| 104 | + catch (TmdbException $ex) |
|
| 105 | + { |
|
| 96 | 106 | throw $ex; |
| 97 | 107 | } |
| 98 | 108 | } |
@@ -103,7 +113,8 @@ discard block |
||
| 103 | 113 | */ |
| 104 | 114 | private function genreItemGenerator(array $results) |
| 105 | 115 | { |
| 106 | - foreach ($results as $result) { |
|
| 116 | + foreach ($results as $result) |
|
| 117 | + { |
|
| 107 | 118 | yield $result; |
| 108 | 119 | } |
| 109 | 120 | } |
@@ -81,7 +81,8 @@ |
||
| 81 | 81 | */ |
| 82 | 82 | private function genreItemGenerator(array $results) |
| 83 | 83 | { |
| 84 | - foreach ($results as $result) { |
|
| 84 | + foreach ($results as $result) |
|
| 85 | + { |
|
| 85 | 86 | yield $result; |
| 86 | 87 | } |
| 87 | 88 | } |
@@ -102,7 +102,8 @@ |
||
| 102 | 102 | */ |
| 103 | 103 | public function checkDependency(BuilderInterface $builder) |
| 104 | 104 | { |
| 105 | - if (! class_exists($builder->getMainClassName())) { |
|
| 105 | + if (! class_exists($builder->getMainClassName())) |
|
| 106 | + { |
|
| 106 | 107 | $message = "missing {$builder->getPackageName()}, please install it using composer : composer require {$builder->getPackageName()}"; |
| 107 | 108 | throw new MissingDependencyException($message); |
| 108 | 109 | } |
@@ -128,7 +128,9 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | $this->logger->debug('Starting search movie'); |
| 130 | 130 | return $this->searchItem('movie', $query, $options, Results\Movie::class); |
| 131 | - } catch (TmdbException $ex) { |
|
| 131 | + } |
|
| 132 | + catch (TmdbException $ex) |
|
| 133 | + { |
|
| 132 | 134 | throw $ex; |
| 133 | 135 | } |
| 134 | 136 | } |
@@ -146,7 +148,9 @@ discard block |
||
| 146 | 148 | { |
| 147 | 149 | $this->logger->debug('Starting search tv show'); |
| 148 | 150 | return $this->searchItem('tv', $query, $options, Results\TVShow::class); |
| 149 | - } catch (TmdbException $ex) { |
|
| 151 | + } |
|
| 152 | + catch (TmdbException $ex) |
|
| 153 | + { |
|
| 150 | 154 | throw $ex; |
| 151 | 155 | } |
| 152 | 156 | } |
@@ -164,7 +168,9 @@ discard block |
||
| 164 | 168 | { |
| 165 | 169 | $this->logger->debug('Starting search collection'); |
| 166 | 170 | return $this->searchItem('collection', $query, $options, Results\Collection::class); |
| 167 | - } catch (TmdbException $ex) { |
|
| 171 | + } |
|
| 172 | + catch (TmdbException $ex) |
|
| 173 | + { |
|
| 168 | 174 | throw $ex; |
| 169 | 175 | } |
| 170 | 176 | } |
@@ -60,7 +60,8 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function getGenres() |
| 62 | 62 | { |
| 63 | - if (isset($this->data->genres)) { |
|
| 63 | + if (isset($this->data->genres)) |
|
| 64 | + { |
|
| 64 | 65 | return $this->data->genres; |
| 65 | 66 | } |
| 66 | 67 | return []; |
@@ -72,7 +73,8 @@ discard block |
||
| 72 | 73 | */ |
| 73 | 74 | public function getNote() |
| 74 | 75 | { |
| 75 | - if (isset($this->data->vote_average)) { |
|
| 76 | + if (isset($this->data->vote_average)) |
|
| 77 | + { |
|
| 76 | 78 | return $this->data->vote_average; |
| 77 | 79 | } |
| 78 | 80 | return 0; |
@@ -84,7 +86,8 @@ discard block |
||
| 84 | 86 | */ |
| 85 | 87 | public function getNumberEpisodes() |
| 86 | 88 | { |
| 87 | - if (isset($this->data->number_of_episodes)) { |
|
| 89 | + if (isset($this->data->number_of_episodes)) |
|
| 90 | + { |
|
| 88 | 91 | return $this->data->number_of_episodes; |
| 89 | 92 | } |
| 90 | 93 | return 0; |
@@ -96,7 +99,8 @@ discard block |
||
| 96 | 99 | */ |
| 97 | 100 | public function getNumberSeasons() |
| 98 | 101 | { |
| 99 | - if (isset($this->data->number_of_seasons)) { |
|
| 102 | + if (isset($this->data->number_of_seasons)) |
|
| 103 | + { |
|
| 100 | 104 | return $this->data->number_of_seasons; |
| 101 | 105 | } |
| 102 | 106 | return 0; |
@@ -108,7 +112,8 @@ discard block |
||
| 108 | 112 | */ |
| 109 | 113 | public function getOriginalTitle() |
| 110 | 114 | { |
| 111 | - if (isset($this->data->original_name)) { |
|
| 115 | + if (isset($this->data->original_name)) |
|
| 116 | + { |
|
| 112 | 117 | return $this->data->original_name; |
| 113 | 118 | } |
| 114 | 119 | return ''; |
@@ -120,7 +125,8 @@ discard block |
||
| 120 | 125 | */ |
| 121 | 126 | public function getOverview() |
| 122 | 127 | { |
| 123 | - if (isset($this->data->overview)) { |
|
| 128 | + if (isset($this->data->overview)) |
|
| 129 | + { |
|
| 124 | 130 | return $this->data->overview; |
| 125 | 131 | } |
| 126 | 132 | return ''; |
@@ -132,7 +138,8 @@ discard block |
||
| 132 | 138 | */ |
| 133 | 139 | public function getReleaseDate() |
| 134 | 140 | { |
| 135 | - if (isset($this->data->first_air_date)) { |
|
| 141 | + if (isset($this->data->first_air_date)) |
|
| 142 | + { |
|
| 136 | 143 | return $this->data->first_air_date; |
| 137 | 144 | } |
| 138 | 145 | return ''; |
@@ -144,7 +151,8 @@ discard block |
||
| 144 | 151 | */ |
| 145 | 152 | public function getStatus() |
| 146 | 153 | { |
| 147 | - if (isset($this->data->status)) { |
|
| 154 | + if (isset($this->data->status)) |
|
| 155 | + { |
|
| 148 | 156 | return $this->data->status; |
| 149 | 157 | } |
| 150 | 158 | return ''; |
@@ -156,7 +164,8 @@ discard block |
||
| 156 | 164 | */ |
| 157 | 165 | public function getTitle() |
| 158 | 166 | { |
| 159 | - if (isset($this->data->name)) { |
|
| 167 | + if (isset($this->data->name)) |
|
| 168 | + { |
|
| 160 | 169 | return $this->data->name; |
| 161 | 170 | } |
| 162 | 171 | return ''; |
@@ -168,8 +177,10 @@ discard block |
||
| 168 | 177 | */ |
| 169 | 178 | public function getSeasons() |
| 170 | 179 | { |
| 171 | - if (!empty($this->data->seasons)) { |
|
| 172 | - foreach ($this->data->seasons as $season) { |
|
| 180 | + if (!empty($this->data->seasons)) |
|
| 181 | + { |
|
| 182 | + foreach ($this->data->seasons as $season) |
|
| 183 | + { |
|
| 173 | 184 | $season = new \vfalies\tmdb\Results\TVSeason($this->tmdb, $season); |
| 174 | 185 | yield $season; |
| 175 | 186 | } |
@@ -48,7 +48,8 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function getDescription() |
| 50 | 50 | { |
| 51 | - if (isset($this->data->description)) { |
|
| 51 | + if (isset($this->data->description)) |
|
| 52 | + { |
|
| 52 | 53 | return $this->data->description; |
| 53 | 54 | } |
| 54 | 55 | return ''; |
@@ -60,7 +61,8 @@ discard block |
||
| 60 | 61 | */ |
| 61 | 62 | public function getHeadQuarters() |
| 62 | 63 | { |
| 63 | - if (isset($this->data->headquarters)) { |
|
| 64 | + if (isset($this->data->headquarters)) |
|
| 65 | + { |
|
| 64 | 66 | return $this->data->headquarters; |
| 65 | 67 | } |
| 66 | 68 | return ''; |
@@ -72,7 +74,8 @@ discard block |
||
| 72 | 74 | */ |
| 73 | 75 | public function getHomePage() |
| 74 | 76 | { |
| 75 | - if (isset($this->data->homepage)) { |
|
| 77 | + if (isset($this->data->homepage)) |
|
| 78 | + { |
|
| 76 | 79 | return $this->data->homepage; |
| 77 | 80 | } |
| 78 | 81 | return ''; |
@@ -84,7 +87,8 @@ discard block |
||
| 84 | 87 | */ |
| 85 | 88 | public function getId() |
| 86 | 89 | { |
| 87 | - if (isset($this->data->id)) { |
|
| 90 | + if (isset($this->data->id)) |
|
| 91 | + { |
|
| 88 | 92 | return $this->data->id; |
| 89 | 93 | } |
| 90 | 94 | return 0; |
@@ -96,7 +100,8 @@ discard block |
||
| 96 | 100 | */ |
| 97 | 101 | public function getLogoPath() |
| 98 | 102 | { |
| 99 | - if (isset($this->data->logo_path)) { |
|
| 103 | + if (isset($this->data->logo_path)) |
|
| 104 | + { |
|
| 100 | 105 | return $this->data->logo_path; |
| 101 | 106 | } |
| 102 | 107 | return ''; |
@@ -108,7 +113,8 @@ discard block |
||
| 108 | 113 | */ |
| 109 | 114 | public function getName() |
| 110 | 115 | { |
| 111 | - if (isset($this->data->name)) { |
|
| 116 | + if (isset($this->data->name)) |
|
| 117 | + { |
|
| 112 | 118 | return $this->data->name; |
| 113 | 119 | } |
| 114 | 120 | return ''; |
@@ -82,7 +82,8 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function getName() |
| 84 | 84 | { |
| 85 | - if (isset($this->data->name)) { |
|
| 85 | + if (isset($this->data->name)) |
|
| 86 | + { |
|
| 86 | 87 | return $this->data->name; |
| 87 | 88 | } |
| 88 | 89 | $this->logger->error('Collection name not found', array('collection_id' => $this->id)); |
@@ -95,8 +96,10 @@ discard block |
||
| 95 | 96 | */ |
| 96 | 97 | public function getParts() |
| 97 | 98 | { |
| 98 | - if (!empty($this->data->parts)) { |
|
| 99 | - foreach ($this->data->parts as $part) { |
|
| 99 | + if (!empty($this->data->parts)) |
|
| 100 | + { |
|
| 101 | + foreach ($this->data->parts as $part) |
|
| 102 | + { |
|
| 100 | 103 | $movie = new \vfalies\tmdb\Results\Movie($this->tmdb, $part); |
| 101 | 104 | yield $movie; |
| 102 | 105 | } |
@@ -120,12 +120,14 @@ |
||
| 120 | 120 | */ |
| 121 | 121 | private function getImage($type, $size, $filepath) |
| 122 | 122 | { |
| 123 | - if (!isset($this->conf->images->base_url)) { |
|
| 123 | + if (!isset($this->conf->images->base_url)) |
|
| 124 | + { |
|
| 124 | 125 | $this->logger->error('No image base url found from configuration'); |
| 125 | 126 | throw new NotFoundException; |
| 126 | 127 | } |
| 127 | 128 | $sizes = $type . '_sizes'; |
| 128 | - if (!in_array($size, $this->conf->images->$sizes)) { |
|
| 129 | + if (!in_array($size, $this->conf->images->$sizes)) |
|
| 130 | + { |
|
| 129 | 131 | $this->logger->error('Incorrect param image size', array('type' => $type, 'size' => $size, 'filepath' => $filepath)); |
| 130 | 132 | throw new IncorrectParamException; |
| 131 | 133 | } |
@@ -62,7 +62,8 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | $logger = new Logger($this->loggerName); |
| 64 | 64 | |
| 65 | - foreach ($this->handlersConfig as $config) { |
|
| 65 | + foreach ($this->handlersConfig as $config) |
|
| 66 | + { |
|
| 66 | 67 | $handler = $this->newHandler($config['class'], $config['params']); |
| 67 | 68 | $logger->pushHandler($handler); |
| 68 | 69 | } |
@@ -80,7 +81,8 @@ discard block |
||
| 80 | 81 | { |
| 81 | 82 | $reflection = new \ReflectionClass($class); |
| 82 | 83 | |
| 83 | - if (! $reflection->implementsInterface('Monolog\Handler\HandlerInterface')) { |
|
| 84 | + if (! $reflection->implementsInterface('Monolog\Handler\HandlerInterface')) |
|
| 85 | + { |
|
| 84 | 86 | throw new \InvalidArgumentException(); |
| 85 | 87 | } |
| 86 | 88 | |