@@ -51,9 +51,12 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function getMovieList(array $options = array()) : \Generator |
| 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()) : \Generator |
| 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(string $type, array $options) : \Generator |
| 84 | 90 | { |
| 85 | - try { |
|
| 91 | + try |
|
| 92 | + { |
|
| 86 | 93 | $params = $this->tmdb->checkOptions($options); |
| 87 | 94 | $response = $this->tmdb->getRequest($type, $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 | } |
@@ -104,7 +114,8 @@ discard block |
||
| 104 | 114 | */ |
| 105 | 115 | private function genreItemGenerator(array $results) : \Generator |
| 106 | 116 | { |
| 107 | - foreach ($results as $result) { |
|
| 117 | + foreach ($results as $result) |
|
| 118 | + { |
|
| 108 | 119 | yield $result; |
| 109 | 120 | } |
| 110 | 121 | } |
@@ -50,13 +50,16 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function getList(array $options = array()) : \Generator |
| 52 | 52 | { |
| 53 | - try { |
|
| 53 | + try |
|
| 54 | + { |
|
| 54 | 55 | $params = $this->tmdb->checkOptions($options); |
| 55 | 56 | $response = $this->tmdb->getRequest('job/list', $params); |
| 56 | 57 | |
| 57 | 58 | $results = []; |
| 58 | - if (isset($response->jobs)) { |
|
| 59 | - foreach ($response->jobs as $j) { |
|
| 59 | + if (isset($response->jobs)) |
|
| 60 | + { |
|
| 61 | + foreach ($response->jobs as $j) |
|
| 62 | + { |
|
| 60 | 63 | $result = new \stdClass(); |
| 61 | 64 | $result->department = $j->department; |
| 62 | 65 | $result->jobs = $j->job_list; |
@@ -64,7 +67,9 @@ discard block |
||
| 64 | 67 | $results[] = $result; |
| 65 | 68 | } |
| 66 | 69 | } |
| 67 | - } catch (TmdbException $ex) { |
|
| 70 | + } |
|
| 71 | + catch (TmdbException $ex) |
|
| 72 | + { |
|
| 68 | 73 | throw $ex; |
| 69 | 74 | } |
| 70 | 75 | return $this->genreItemGenerator($results); |
@@ -77,7 +82,8 @@ discard block |
||
| 77 | 82 | */ |
| 78 | 83 | private function genreItemGenerator(array $results) : \Generator |
| 79 | 84 | { |
| 80 | - foreach ($results as $result) { |
|
| 85 | + foreach ($results as $result) |
|
| 86 | + { |
|
| 81 | 87 | yield $result; |
| 82 | 88 | } |
| 83 | 89 | } |
@@ -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 | |
@@ -87,7 +87,8 @@ |
||
| 87 | 87 | */ |
| 88 | 88 | public function __construct(TmdbInterface $tmdb, \stdClass $result) |
| 89 | 89 | { |
| 90 | - if (!isset($result->episode_count)) { |
|
| 90 | + if (!isset($result->episode_count)) |
|
| 91 | + { |
|
| 91 | 92 | $result->episode_count = null; |
| 92 | 93 | } |
| 93 | 94 | parent::__construct($tmdb, $result); |
@@ -96,13 +96,16 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function __construct(TmdbInterface $tmdb, \stdClass $result) |
| 98 | 98 | { |
| 99 | - if (!isset($result->overview)) { |
|
| 99 | + if (!isset($result->overview)) |
|
| 100 | + { |
|
| 100 | 101 | $result->overview = null; |
| 101 | 102 | } |
| 102 | - if (!isset($result->production_code)) { |
|
| 103 | + if (!isset($result->production_code)) |
|
| 104 | + { |
|
| 103 | 105 | $result->production_code = null; |
| 104 | 106 | } |
| 105 | - if (!isset($result->guest_stars)) { |
|
| 107 | + if (!isset($result->guest_stars)) |
|
| 108 | + { |
|
| 106 | 109 | $result->guest_stars = null; |
| 107 | 110 | } |
| 108 | 111 | |
@@ -146,8 +149,10 @@ discard block |
||
| 146 | 149 | */ |
| 147 | 150 | public function getGuestStars() : \Generator |
| 148 | 151 | { |
| 149 | - if (isset($this->guest_stars)) { |
|
| 150 | - foreach ($this->guest_stars as $gs) { |
|
| 152 | + if (isset($this->guest_stars)) |
|
| 153 | + { |
|
| 154 | + foreach ($this->guest_stars as $gs) |
|
| 155 | + { |
|
| 151 | 156 | $gs->gender = null; |
| 152 | 157 | $gs->cast_id = null; |
| 153 | 158 | |
@@ -56,7 +56,8 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function getGenres() : array |
| 58 | 58 | { |
| 59 | - if (isset($this->data->genres)) { |
|
| 59 | + if (isset($this->data->genres)) |
|
| 60 | + { |
|
| 60 | 61 | return $this->data->genres; |
| 61 | 62 | } |
| 62 | 63 | return []; |
@@ -68,7 +69,8 @@ discard block |
||
| 68 | 69 | */ |
| 69 | 70 | public function getNote() : float |
| 70 | 71 | { |
| 71 | - if (isset($this->data->vote_average)) { |
|
| 72 | + if (isset($this->data->vote_average)) |
|
| 73 | + { |
|
| 72 | 74 | return $this->data->vote_average; |
| 73 | 75 | } |
| 74 | 76 | return 0; |
@@ -80,7 +82,8 @@ discard block |
||
| 80 | 82 | */ |
| 81 | 83 | public function getNumberEpisodes() : int |
| 82 | 84 | { |
| 83 | - if (isset($this->data->number_of_episodes)) { |
|
| 85 | + if (isset($this->data->number_of_episodes)) |
|
| 86 | + { |
|
| 84 | 87 | return $this->data->number_of_episodes; |
| 85 | 88 | } |
| 86 | 89 | return 0; |
@@ -92,7 +95,8 @@ discard block |
||
| 92 | 95 | */ |
| 93 | 96 | public function getNumberSeasons() : int |
| 94 | 97 | { |
| 95 | - if (isset($this->data->number_of_seasons)) { |
|
| 98 | + if (isset($this->data->number_of_seasons)) |
|
| 99 | + { |
|
| 96 | 100 | return $this->data->number_of_seasons; |
| 97 | 101 | } |
| 98 | 102 | return 0; |
@@ -104,7 +108,8 @@ discard block |
||
| 104 | 108 | */ |
| 105 | 109 | public function getOriginalTitle() : string |
| 106 | 110 | { |
| 107 | - if (isset($this->data->original_name)) { |
|
| 111 | + if (isset($this->data->original_name)) |
|
| 112 | + { |
|
| 108 | 113 | return $this->data->original_name; |
| 109 | 114 | } |
| 110 | 115 | return ''; |
@@ -116,7 +121,8 @@ discard block |
||
| 116 | 121 | */ |
| 117 | 122 | public function getOverview() : string |
| 118 | 123 | { |
| 119 | - if (isset($this->data->overview)) { |
|
| 124 | + if (isset($this->data->overview)) |
|
| 125 | + { |
|
| 120 | 126 | return $this->data->overview; |
| 121 | 127 | } |
| 122 | 128 | return ''; |
@@ -128,7 +134,8 @@ discard block |
||
| 128 | 134 | */ |
| 129 | 135 | public function getReleaseDate() : string |
| 130 | 136 | { |
| 131 | - if (isset($this->data->first_air_date)) { |
|
| 137 | + if (isset($this->data->first_air_date)) |
|
| 138 | + { |
|
| 132 | 139 | return $this->data->first_air_date; |
| 133 | 140 | } |
| 134 | 141 | return ''; |
@@ -140,7 +147,8 @@ discard block |
||
| 140 | 147 | */ |
| 141 | 148 | public function getStatus() : string |
| 142 | 149 | { |
| 143 | - if (isset($this->data->status)) { |
|
| 150 | + if (isset($this->data->status)) |
|
| 151 | + { |
|
| 144 | 152 | return $this->data->status; |
| 145 | 153 | } |
| 146 | 154 | return ''; |
@@ -152,7 +160,8 @@ discard block |
||
| 152 | 160 | */ |
| 153 | 161 | public function getTitle() : string |
| 154 | 162 | { |
| 155 | - if (isset($this->data->name)) { |
|
| 163 | + if (isset($this->data->name)) |
|
| 164 | + { |
|
| 156 | 165 | return $this->data->name; |
| 157 | 166 | } |
| 158 | 167 | return ''; |
@@ -164,8 +173,10 @@ discard block |
||
| 164 | 173 | */ |
| 165 | 174 | public function getSeasons() : \Generator |
| 166 | 175 | { |
| 167 | - if (!empty($this->data->seasons)) { |
|
| 168 | - foreach ($this->data->seasons as $season) { |
|
| 176 | + if (!empty($this->data->seasons)) |
|
| 177 | + { |
|
| 178 | + foreach ($this->data->seasons as $season) |
|
| 179 | + { |
|
| 169 | 180 | $season = new Results\TVSeason($this->tmdb, $season); |
| 170 | 181 | yield $season; |
| 171 | 182 | } |
@@ -178,8 +189,10 @@ discard block |
||
| 178 | 189 | */ |
| 179 | 190 | public function getNetworks() : \Generator |
| 180 | 191 | { |
| 181 | - if (!empty($this->data->networks)) { |
|
| 182 | - foreach ($this->data->networks as $network) { |
|
| 192 | + if (!empty($this->data->networks)) |
|
| 193 | + { |
|
| 194 | + foreach ($this->data->networks as $network) |
|
| 195 | + { |
|
| 183 | 196 | $n = new \stdClass(); |
| 184 | 197 | $n->id = $network->id; |
| 185 | 198 | $n->name = $network->name; |
@@ -197,7 +210,8 @@ discard block |
||
| 197 | 210 | { |
| 198 | 211 | $data = $this->tmdb->getRequest('tv/' . (int) $this->id . '/images', $this->params); |
| 199 | 212 | |
| 200 | - foreach ($data->backdrops as $b) { |
|
| 213 | + foreach ($data->backdrops as $b) |
|
| 214 | + { |
|
| 201 | 215 | $image = new Results\Image($this->tmdb, $this->id, $b); |
| 202 | 216 | yield $image; |
| 203 | 217 | } |
@@ -211,7 +225,8 @@ discard block |
||
| 211 | 225 | { |
| 212 | 226 | $data = $this->tmdb->getRequest('tv/' . (int) $this->id . '/images', $this->params); |
| 213 | 227 | |
| 214 | - foreach ($data->posters as $b) { |
|
| 228 | + foreach ($data->posters as $b) |
|
| 229 | + { |
|
| 215 | 230 | $image = new Results\Image($this->tmdb, $this->id, $b); |
| 216 | 231 | yield $image; |
| 217 | 232 | } |
@@ -225,7 +240,8 @@ discard block |
||
| 225 | 240 | { |
| 226 | 241 | $similar = $this->tmdb->getRequest('tv/' . (int) $this->id . '/similar', $this->params); |
| 227 | 242 | |
| 228 | - foreach ($similar->results as $t) { |
|
| 243 | + foreach ($similar->results as $t) |
|
| 244 | + { |
|
| 229 | 245 | $tvshow = new Results\TVShow($this->tmdb, $t); |
| 230 | 246 | yield $tvshow; |
| 231 | 247 | } |
@@ -51,8 +51,10 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function getCrew() : \Generator |
| 53 | 53 | { |
| 54 | - if (!empty($this->data->crew)) { |
|
| 55 | - foreach ($this->data->crew as $c) { |
|
| 54 | + if (!empty($this->data->crew)) |
|
| 55 | + { |
|
| 56 | + foreach ($this->data->crew as $c) |
|
| 57 | + { |
|
| 56 | 58 | $crew = new Results\Crew($this->tmdb, $c); |
| 57 | 59 | yield $crew; |
| 58 | 60 | } |
@@ -65,8 +67,10 @@ discard block |
||
| 65 | 67 | */ |
| 66 | 68 | public function getCast() : \Generator |
| 67 | 69 | { |
| 68 | - if (!empty($this->data->cast)) { |
|
| 69 | - foreach ($this->data->cast as $c) { |
|
| 70 | + if (!empty($this->data->cast)) |
|
| 71 | + { |
|
| 72 | + foreach ($this->data->cast as $c) |
|
| 73 | + { |
|
| 70 | 74 | $cast = new Results\Cast($this->tmdb, $c); |
| 71 | 75 | yield $cast; |
| 72 | 76 | } |
@@ -65,7 +65,8 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function getId() : int |
| 67 | 67 | { |
| 68 | - if (!empty($this->data->id)) { |
|
| 68 | + if (!empty($this->data->id)) |
|
| 69 | + { |
|
| 69 | 70 | return (int) $this->data->id; |
| 70 | 71 | } |
| 71 | 72 | return 0; |
@@ -77,7 +78,8 @@ discard block |
||
| 77 | 78 | */ |
| 78 | 79 | public function getAirDate() : string |
| 79 | 80 | { |
| 80 | - if (!empty($this->data->air_date)) { |
|
| 81 | + if (!empty($this->data->air_date)) |
|
| 82 | + { |
|
| 81 | 83 | return $this->data->air_date; |
| 82 | 84 | } |
| 83 | 85 | return ''; |
@@ -89,7 +91,8 @@ discard block |
||
| 89 | 91 | */ |
| 90 | 92 | public function getEpisodeCount() : int |
| 91 | 93 | { |
| 92 | - if (!empty($this->data->episodes)) { |
|
| 94 | + if (!empty($this->data->episodes)) |
|
| 95 | + { |
|
| 93 | 96 | return count($this->data->episodes); |
| 94 | 97 | } |
| 95 | 98 | return 0; |
@@ -101,7 +104,8 @@ discard block |
||
| 101 | 104 | */ |
| 102 | 105 | public function getSeasonNumber() : int |
| 103 | 106 | { |
| 104 | - if (!empty($this->data->season_number)) { |
|
| 107 | + if (!empty($this->data->season_number)) |
|
| 108 | + { |
|
| 105 | 109 | return (int) $this->data->season_number; |
| 106 | 110 | } |
| 107 | 111 | return 0; |
@@ -113,8 +117,10 @@ discard block |
||
| 113 | 117 | */ |
| 114 | 118 | public function getEpisodes() : \Generator |
| 115 | 119 | { |
| 116 | - if (!empty($this->data->episodes)) { |
|
| 117 | - foreach ($this->data->episodes as $episode) { |
|
| 120 | + if (!empty($this->data->episodes)) |
|
| 121 | + { |
|
| 122 | + foreach ($this->data->episodes as $episode) |
|
| 123 | + { |
|
| 118 | 124 | $episode = new Results\TVEpisode($this->tmdb, $episode); |
| 119 | 125 | yield $episode; |
| 120 | 126 | } |
@@ -127,7 +133,8 @@ discard block |
||
| 127 | 133 | */ |
| 128 | 134 | public function getName() : string |
| 129 | 135 | { |
| 130 | - if (!empty($this->data->name)) { |
|
| 136 | + if (!empty($this->data->name)) |
|
| 137 | + { |
|
| 131 | 138 | return $this->data->name; |
| 132 | 139 | } |
| 133 | 140 | return ''; |
@@ -139,7 +146,8 @@ discard block |
||
| 139 | 146 | */ |
| 140 | 147 | public function getOverview() : string |
| 141 | 148 | { |
| 142 | - if (!empty($this->data->overview)) { |
|
| 149 | + if (!empty($this->data->overview)) |
|
| 150 | + { |
|
| 143 | 151 | return $this->data->overview; |
| 144 | 152 | } |
| 145 | 153 | return ''; |
@@ -153,7 +161,8 @@ discard block |
||
| 153 | 161 | { |
| 154 | 162 | $data = $this->tmdb->getRequest('tv/' . (int) $this->tv_id . '/season/' . $this->season_number . '/images', $this->params); |
| 155 | 163 | |
| 156 | - foreach ($data->posters as $b) { |
|
| 164 | + foreach ($data->posters as $b) |
|
| 165 | + { |
|
| 157 | 166 | $image = new Results\Image($this->tmdb, $this->id, $b); |
| 158 | 167 | yield $image; |
| 159 | 168 | } |
@@ -37,12 +37,15 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function __construct(TmdbInterface $tmdb, int $people_id, array $options = array()) |
| 39 | 39 | { |
| 40 | - try { |
|
| 40 | + try |
|
| 41 | + { |
|
| 41 | 42 | $this->tmdb = $tmdb; |
| 42 | 43 | $this->logger = $tmdb->getLogger(); |
| 43 | 44 | $this->params = $this->tmdb->checkOptions($options); |
| 44 | 45 | $this->data = $this->tmdb->getRequest('person/' . $people_id.'/movie_credits', $this->params); |
| 45 | - } catch (TmdbException $ex) { |
|
| 46 | + } |
|
| 47 | + catch (TmdbException $ex) |
|
| 48 | + { |
|
| 46 | 49 | throw $ex; |
| 47 | 50 | } |
| 48 | 51 | } |
@@ -53,8 +56,10 @@ discard block |
||
| 53 | 56 | */ |
| 54 | 57 | public function getCrew() : \Generator |
| 55 | 58 | { |
| 56 | - if (!empty($this->data->crew)) { |
|
| 57 | - foreach ($this->data->crew as $c) { |
|
| 59 | + if (!empty($this->data->crew)) |
|
| 60 | + { |
|
| 61 | + foreach ($this->data->crew as $c) |
|
| 62 | + { |
|
| 58 | 63 | $crew = new PeopleMovieCrew($this->tmdb, $c); |
| 59 | 64 | yield $crew; |
| 60 | 65 | } |
@@ -67,8 +72,10 @@ discard block |
||
| 67 | 72 | */ |
| 68 | 73 | public function getCast() : \Generator |
| 69 | 74 | { |
| 70 | - if (!empty($this->data->cast)) { |
|
| 71 | - foreach ($this->data->cast as $c) { |
|
| 75 | + if (!empty($this->data->cast)) |
|
| 76 | + { |
|
| 77 | + foreach ($this->data->cast as $c) |
|
| 78 | + { |
|
| 72 | 79 | $cast = new PeopleMovieCast($this->tmdb, $c); |
| 73 | 80 | yield $cast; |
| 74 | 81 | } |