@@ -47,7 +47,8 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function getDescription() : string |
| 49 | 49 | { |
| 50 | - if (isset($this->data->description)) { |
|
| 50 | + if (isset($this->data->description)) |
|
| 51 | + { |
|
| 51 | 52 | return $this->data->description; |
| 52 | 53 | } |
| 53 | 54 | return ''; |
@@ -59,7 +60,8 @@ discard block |
||
| 59 | 60 | */ |
| 60 | 61 | public function getHeadQuarters() : string |
| 61 | 62 | { |
| 62 | - if (isset($this->data->headquarters)) { |
|
| 63 | + if (isset($this->data->headquarters)) |
|
| 64 | + { |
|
| 63 | 65 | return $this->data->headquarters; |
| 64 | 66 | } |
| 65 | 67 | return ''; |
@@ -71,7 +73,8 @@ discard block |
||
| 71 | 73 | */ |
| 72 | 74 | public function getHomePage() : string |
| 73 | 75 | { |
| 74 | - if (isset($this->data->homepage)) { |
|
| 76 | + if (isset($this->data->homepage)) |
|
| 77 | + { |
|
| 75 | 78 | return $this->data->homepage; |
| 76 | 79 | } |
| 77 | 80 | return ''; |
@@ -83,7 +86,8 @@ discard block |
||
| 83 | 86 | */ |
| 84 | 87 | public function getId() : int |
| 85 | 88 | { |
| 86 | - if (isset($this->data->id)) { |
|
| 89 | + if (isset($this->data->id)) |
|
| 90 | + { |
|
| 87 | 91 | return $this->data->id; |
| 88 | 92 | } |
| 89 | 93 | return 0; |
@@ -95,7 +99,8 @@ discard block |
||
| 95 | 99 | */ |
| 96 | 100 | public function getLogoPath() : string |
| 97 | 101 | { |
| 98 | - if (isset($this->data->logo_path)) { |
|
| 102 | + if (isset($this->data->logo_path)) |
|
| 103 | + { |
|
| 99 | 104 | return $this->data->logo_path; |
| 100 | 105 | } |
| 101 | 106 | return ''; |
@@ -107,7 +112,8 @@ discard block |
||
| 107 | 112 | */ |
| 108 | 113 | public function getName() : string |
| 109 | 114 | { |
| 110 | - if (isset($this->data->name)) { |
|
| 115 | + if (isset($this->data->name)) |
|
| 116 | + { |
|
| 111 | 117 | return $this->data->name; |
| 112 | 118 | } |
| 113 | 119 | return ''; |
@@ -121,7 +127,8 @@ discard block |
||
| 121 | 127 | { |
| 122 | 128 | $data = $this->tmdb->getRequest('company/' . (int) $this->id . '/movies', $this->params); |
| 123 | 129 | |
| 124 | - foreach ($data->results as $m) { |
|
| 130 | + foreach ($data->results as $m) |
|
| 131 | + { |
|
| 125 | 132 | $movie = new Results\Movie($this->tmdb, $m); |
| 126 | 133 | yield $movie; |
| 127 | 134 | } |
@@ -49,7 +49,8 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public function getGenres() : array |
| 51 | 51 | { |
| 52 | - if (isset($this->data->genres)) { |
|
| 52 | + if (isset($this->data->genres)) |
|
| 53 | + { |
|
| 53 | 54 | return $this->data->genres; |
| 54 | 55 | } |
| 55 | 56 | return []; |
@@ -61,7 +62,8 @@ discard block |
||
| 61 | 62 | */ |
| 62 | 63 | public function getTitle() : string |
| 63 | 64 | { |
| 64 | - if (isset($this->data->title)) { |
|
| 65 | + if (isset($this->data->title)) |
|
| 66 | + { |
|
| 65 | 67 | return $this->data->title; |
| 66 | 68 | } |
| 67 | 69 | return ''; |
@@ -73,7 +75,8 @@ discard block |
||
| 73 | 75 | */ |
| 74 | 76 | public function getOverview() : string |
| 75 | 77 | { |
| 76 | - if (isset($this->data->overview)) { |
|
| 78 | + if (isset($this->data->overview)) |
|
| 79 | + { |
|
| 77 | 80 | return $this->data->overview; |
| 78 | 81 | } |
| 79 | 82 | return ''; |
@@ -85,7 +88,8 @@ discard block |
||
| 85 | 88 | */ |
| 86 | 89 | public function getReleaseDate() : string |
| 87 | 90 | { |
| 88 | - if (isset($this->data->release_date)) { |
|
| 91 | + if (isset($this->data->release_date)) |
|
| 92 | + { |
|
| 89 | 93 | return $this->data->release_date; |
| 90 | 94 | } |
| 91 | 95 | return ''; |
@@ -97,7 +101,8 @@ discard block |
||
| 97 | 101 | */ |
| 98 | 102 | public function getOriginalTitle() : string |
| 99 | 103 | { |
| 100 | - if (isset($this->data->original_title)) { |
|
| 104 | + if (isset($this->data->original_title)) |
|
| 105 | + { |
|
| 101 | 106 | return $this->data->original_title; |
| 102 | 107 | } |
| 103 | 108 | return ''; |
@@ -109,7 +114,8 @@ discard block |
||
| 109 | 114 | */ |
| 110 | 115 | public function getNote() : float |
| 111 | 116 | { |
| 112 | - if (isset($this->data->vote_average)) { |
|
| 117 | + if (isset($this->data->vote_average)) |
|
| 118 | + { |
|
| 113 | 119 | return $this->data->vote_average; |
| 114 | 120 | } |
| 115 | 121 | return 0; |
@@ -130,7 +136,8 @@ discard block |
||
| 130 | 136 | */ |
| 131 | 137 | public function getIMDBId() : string |
| 132 | 138 | { |
| 133 | - if (isset($this->data->imdb_id)) { |
|
| 139 | + if (isset($this->data->imdb_id)) |
|
| 140 | + { |
|
| 134 | 141 | return $this->data->imdb_id; |
| 135 | 142 | } |
| 136 | 143 | return ''; |
@@ -142,7 +149,8 @@ discard block |
||
| 142 | 149 | */ |
| 143 | 150 | public function getTagLine() : string |
| 144 | 151 | { |
| 145 | - if (isset($this->data->tagline)) { |
|
| 152 | + if (isset($this->data->tagline)) |
|
| 153 | + { |
|
| 146 | 154 | return $this->data->tagline; |
| 147 | 155 | } |
| 148 | 156 | return ''; |
@@ -154,7 +162,8 @@ discard block |
||
| 154 | 162 | */ |
| 155 | 163 | public function getCollectionId() : int |
| 156 | 164 | { |
| 157 | - if (!empty($this->data->belongs_to_collection)) { |
|
| 165 | + if (!empty($this->data->belongs_to_collection)) |
|
| 166 | + { |
|
| 158 | 167 | return (int) $this->data->belongs_to_collection->id; |
| 159 | 168 | } |
| 160 | 169 | return 0; |
@@ -186,8 +195,10 @@ discard block |
||
| 186 | 195 | */ |
| 187 | 196 | public function getProductionCompanies() : \Generator |
| 188 | 197 | { |
| 189 | - if (!empty($this->data->production_companies)) { |
|
| 190 | - foreach ($this->data->production_companies as $p) { |
|
| 198 | + if (!empty($this->data->production_companies)) |
|
| 199 | + { |
|
| 200 | + foreach ($this->data->production_companies as $p) |
|
| 201 | + { |
|
| 191 | 202 | $res = new \stdClass(); |
| 192 | 203 | $res->id = $p->id; |
| 193 | 204 | $res->name = $p->name; |
@@ -205,8 +216,10 @@ discard block |
||
| 205 | 216 | */ |
| 206 | 217 | public function getProductionCountries() : \Generator |
| 207 | 218 | { |
| 208 | - if (!empty($this->data->production_countries)) { |
|
| 209 | - foreach ($this->data->production_countries as $c) { |
|
| 219 | + if (!empty($this->data->production_countries)) |
|
| 220 | + { |
|
| 221 | + foreach ($this->data->production_countries as $c) |
|
| 222 | + { |
|
| 210 | 223 | $res = new \stdClass(); |
| 211 | 224 | $res->iso_3166_1 = $c->iso_3166_1; |
| 212 | 225 | $res->name = $c->name; |
@@ -224,7 +237,8 @@ discard block |
||
| 224 | 237 | { |
| 225 | 238 | $data = $this->tmdb->getRequest('movie/' . (int) $this->id . '/images', $this->params); |
| 226 | 239 | |
| 227 | - foreach ($data->backdrops as $b) { |
|
| 240 | + foreach ($data->backdrops as $b) |
|
| 241 | + { |
|
| 228 | 242 | $image = new Results\Image($this->tmdb, $this->id, $b); |
| 229 | 243 | yield $image; |
| 230 | 244 | } |
@@ -238,7 +252,8 @@ discard block |
||
| 238 | 252 | { |
| 239 | 253 | $data = $this->tmdb->getRequest('movie/' . (int) $this->id . '/images', $this->params); |
| 240 | 254 | |
| 241 | - foreach ($data->posters as $b) { |
|
| 255 | + foreach ($data->posters as $b) |
|
| 256 | + { |
|
| 242 | 257 | $image = new Results\Image($this->tmdb, $this->id, $b); |
| 243 | 258 | yield $image; |
| 244 | 259 | } |
@@ -252,7 +267,8 @@ discard block |
||
| 252 | 267 | { |
| 253 | 268 | $data = $this->tmdb->getRequest('movie/' . (int) $this->id . '/similar', $this->params); |
| 254 | 269 | |
| 255 | - foreach ($data->results as $s) { |
|
| 270 | + foreach ($data->results as $s) |
|
| 271 | + { |
|
| 256 | 272 | $movie = new Results\Movie($this->tmdb, $s); |
| 257 | 273 | yield $movie; |
| 258 | 274 | } |
@@ -51,7 +51,8 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function getAdult() : bool |
| 53 | 53 | { |
| 54 | - if (isset($this->data->adult)) { |
|
| 54 | + if (isset($this->data->adult)) |
|
| 55 | + { |
|
| 55 | 56 | return $this->data->adult; |
| 56 | 57 | } |
| 57 | 58 | return false; |
@@ -63,7 +64,8 @@ discard block |
||
| 63 | 64 | */ |
| 64 | 65 | public function getAlsoKnownAs() : array |
| 65 | 66 | { |
| 66 | - if (isset($this->data->also_known_as)) { |
|
| 67 | + if (isset($this->data->also_known_as)) |
|
| 68 | + { |
|
| 67 | 69 | return $this->data->also_known_as; |
| 68 | 70 | } |
| 69 | 71 | return []; |
@@ -75,7 +77,8 @@ discard block |
||
| 75 | 77 | */ |
| 76 | 78 | public function getBiography() : string |
| 77 | 79 | { |
| 78 | - if (isset($this->data->biography)) { |
|
| 80 | + if (isset($this->data->biography)) |
|
| 81 | + { |
|
| 79 | 82 | return $this->data->biography; |
| 80 | 83 | } |
| 81 | 84 | return ''; |
@@ -87,7 +90,8 @@ discard block |
||
| 87 | 90 | */ |
| 88 | 91 | public function getBirthday() : string |
| 89 | 92 | { |
| 90 | - if (isset($this->data->birthday)) { |
|
| 93 | + if (isset($this->data->birthday)) |
|
| 94 | + { |
|
| 91 | 95 | return $this->data->birthday; |
| 92 | 96 | } |
| 93 | 97 | return ''; |
@@ -99,7 +103,8 @@ discard block |
||
| 99 | 103 | */ |
| 100 | 104 | public function getDeathday() : string |
| 101 | 105 | { |
| 102 | - if (isset($this->data->deathday)) { |
|
| 106 | + if (isset($this->data->deathday)) |
|
| 107 | + { |
|
| 103 | 108 | return $this->data->deathday; |
| 104 | 109 | } |
| 105 | 110 | return ''; |
@@ -111,7 +116,8 @@ discard block |
||
| 111 | 116 | */ |
| 112 | 117 | public function getGender() : int |
| 113 | 118 | { |
| 114 | - if (isset($this->data->gender)) { |
|
| 119 | + if (isset($this->data->gender)) |
|
| 120 | + { |
|
| 115 | 121 | return $this->data->gender; |
| 116 | 122 | } |
| 117 | 123 | return 0; |
@@ -123,7 +129,8 @@ discard block |
||
| 123 | 129 | */ |
| 124 | 130 | public function getHomepage() : string |
| 125 | 131 | { |
| 126 | - if (isset($this->data->homepage)) { |
|
| 132 | + if (isset($this->data->homepage)) |
|
| 133 | + { |
|
| 127 | 134 | return $this->data->homepage; |
| 128 | 135 | } |
| 129 | 136 | return ''; |
@@ -135,7 +142,8 @@ discard block |
||
| 135 | 142 | */ |
| 136 | 143 | public function getId() : int |
| 137 | 144 | { |
| 138 | - if (isset($this->data->id)) { |
|
| 145 | + if (isset($this->data->id)) |
|
| 146 | + { |
|
| 139 | 147 | return $this->data->id; |
| 140 | 148 | } |
| 141 | 149 | return 0; |
@@ -147,7 +155,8 @@ discard block |
||
| 147 | 155 | */ |
| 148 | 156 | public function getImdbId() : string |
| 149 | 157 | { |
| 150 | - if (isset($this->data->imdb_id)) { |
|
| 158 | + if (isset($this->data->imdb_id)) |
|
| 159 | + { |
|
| 151 | 160 | return $this->data->imdb_id; |
| 152 | 161 | } |
| 153 | 162 | return ''; |
@@ -159,7 +168,8 @@ discard block |
||
| 159 | 168 | */ |
| 160 | 169 | public function getName() : string |
| 161 | 170 | { |
| 162 | - if (isset($this->data->name)) { |
|
| 171 | + if (isset($this->data->name)) |
|
| 172 | + { |
|
| 163 | 173 | return $this->data->name; |
| 164 | 174 | } |
| 165 | 175 | return ''; |
@@ -171,7 +181,8 @@ discard block |
||
| 171 | 181 | */ |
| 172 | 182 | public function getPlaceOfBirth() : string |
| 173 | 183 | { |
| 174 | - if (isset($this->data->place_of_birth)) { |
|
| 184 | + if (isset($this->data->place_of_birth)) |
|
| 185 | + { |
|
| 175 | 186 | return $this->data->place_of_birth; |
| 176 | 187 | } |
| 177 | 188 | return ''; |
@@ -183,7 +194,8 @@ discard block |
||
| 183 | 194 | */ |
| 184 | 195 | public function getPopularity() : float |
| 185 | 196 | { |
| 186 | - if (isset($this->data->popularity)) { |
|
| 197 | + if (isset($this->data->popularity)) |
|
| 198 | + { |
|
| 187 | 199 | return $this->data->popularity; |
| 188 | 200 | } |
| 189 | 201 | return 0; |
@@ -195,7 +207,8 @@ discard block |
||
| 195 | 207 | */ |
| 196 | 208 | public function getProfilePath() : string |
| 197 | 209 | { |
| 198 | - if (isset($this->data->profile_path)) { |
|
| 210 | + if (isset($this->data->profile_path)) |
|
| 211 | + { |
|
| 199 | 212 | return $this->data->profile_path; |
| 200 | 213 | } |
| 201 | 214 | return ''; |
@@ -209,7 +222,8 @@ discard block |
||
| 209 | 222 | { |
| 210 | 223 | $data = $this->tmdb->getRequest('person/' . (int) $this->id . '/images', $this->params); |
| 211 | 224 | |
| 212 | - foreach ($data->profiles as $b) { |
|
| 225 | + foreach ($data->profiles as $b) |
|
| 226 | + { |
|
| 213 | 227 | $image = new Results\Image($this->tmdb, $this->id, $b); |
| 214 | 228 | yield $image; |
| 215 | 229 | } |
@@ -75,7 +75,8 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function getName() : string |
| 77 | 77 | { |
| 78 | - if (isset($this->data->name)) { |
|
| 78 | + if (isset($this->data->name)) |
|
| 79 | + { |
|
| 79 | 80 | return $this->data->name; |
| 80 | 81 | } |
| 81 | 82 | $this->logger->error('Collection name not found', array('collection_id' => $this->id)); |
@@ -88,8 +89,10 @@ discard block |
||
| 88 | 89 | */ |
| 89 | 90 | public function getParts() : \Generator |
| 90 | 91 | { |
| 91 | - if (!empty($this->data->parts)) { |
|
| 92 | - foreach ($this->data->parts as $part) { |
|
| 92 | + if (!empty($this->data->parts)) |
|
| 93 | + { |
|
| 94 | + foreach ($this->data->parts as $part) |
|
| 95 | + { |
|
| 93 | 96 | $movie = new Results\Movie($this->tmdb, $part); |
| 94 | 97 | yield $movie; |
| 95 | 98 | } |
@@ -104,7 +107,8 @@ discard block |
||
| 104 | 107 | { |
| 105 | 108 | $data = $this->tmdb->getRequest('collection/' . (int) $this->id . '/images', $this->params); |
| 106 | 109 | |
| 107 | - foreach ($data->backdrops as $b) { |
|
| 110 | + foreach ($data->backdrops as $b) |
|
| 111 | + { |
|
| 108 | 112 | $image = new Results\Image($this->tmdb, $this->id, $b); |
| 109 | 113 | yield $image; |
| 110 | 114 | } |
@@ -118,7 +122,8 @@ discard block |
||
| 118 | 122 | { |
| 119 | 123 | $data = $this->tmdb->getRequest('collection/' . (int) $this->id . '/images', $this->params); |
| 120 | 124 | |
| 121 | - foreach ($data->posters as $b) { |
|
| 125 | + foreach ($data->posters as $b) |
|
| 126 | + { |
|
| 122 | 127 | $image = new Results\Image($this->tmdb, $this->id, $b); |
| 123 | 128 | yield $image; |
| 124 | 129 | } |
@@ -71,7 +71,8 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function getId(): int |
| 73 | 73 | { |
| 74 | - if (isset($this->data->id)) { |
|
| 74 | + if (isset($this->data->id)) |
|
| 75 | + { |
|
| 75 | 76 | return (int) $this->data->id; |
| 76 | 77 | } |
| 77 | 78 | return 0; |
@@ -83,7 +84,8 @@ discard block |
||
| 83 | 84 | */ |
| 84 | 85 | public function getAirDate() : string |
| 85 | 86 | { |
| 86 | - if (isset($this->data->air_date)) { |
|
| 87 | + if (isset($this->data->air_date)) |
|
| 88 | + { |
|
| 87 | 89 | return $this->data->air_date; |
| 88 | 90 | } |
| 89 | 91 | return ''; |
@@ -95,7 +97,8 @@ discard block |
||
| 95 | 97 | */ |
| 96 | 98 | public function getEpisodeNumber() : int |
| 97 | 99 | { |
| 98 | - if (isset($this->data->episode_number)) { |
|
| 100 | + if (isset($this->data->episode_number)) |
|
| 101 | + { |
|
| 99 | 102 | return $this->data->episode_number; |
| 100 | 103 | } |
| 101 | 104 | return 0; |
@@ -107,8 +110,10 @@ discard block |
||
| 107 | 110 | */ |
| 108 | 111 | public function getGuestStars() : \Generator |
| 109 | 112 | { |
| 110 | - if (isset($this->data->guest_stars)) { |
|
| 111 | - foreach ($this->data->guest_stars as $gs) { |
|
| 113 | + if (isset($this->data->guest_stars)) |
|
| 114 | + { |
|
| 115 | + foreach ($this->data->guest_stars as $gs) |
|
| 116 | + { |
|
| 112 | 117 | $gs->gender = null; |
| 113 | 118 | $gs->cast_id = null; |
| 114 | 119 | |
@@ -124,7 +129,8 @@ discard block |
||
| 124 | 129 | */ |
| 125 | 130 | public function getName() : string |
| 126 | 131 | { |
| 127 | - if (isset($this->data->name)) { |
|
| 132 | + if (isset($this->data->name)) |
|
| 133 | + { |
|
| 128 | 134 | return $this->data->name; |
| 129 | 135 | } |
| 130 | 136 | return ''; |
@@ -136,7 +142,8 @@ discard block |
||
| 136 | 142 | */ |
| 137 | 143 | public function getNote() : float |
| 138 | 144 | { |
| 139 | - if (isset($this->data->vote_average)) { |
|
| 145 | + if (isset($this->data->vote_average)) |
|
| 146 | + { |
|
| 140 | 147 | return $this->data->vote_average; |
| 141 | 148 | } |
| 142 | 149 | return 0; |
@@ -148,7 +155,8 @@ discard block |
||
| 148 | 155 | */ |
| 149 | 156 | public function getNoteCount() : int |
| 150 | 157 | { |
| 151 | - if (isset($this->data->vote_count)) { |
|
| 158 | + if (isset($this->data->vote_count)) |
|
| 159 | + { |
|
| 152 | 160 | return (int) $this->data->vote_count; |
| 153 | 161 | } |
| 154 | 162 | return 0; |
@@ -160,7 +168,8 @@ discard block |
||
| 160 | 168 | */ |
| 161 | 169 | public function getOverview() : string |
| 162 | 170 | { |
| 163 | - if (isset($this->data->overview)) { |
|
| 171 | + if (isset($this->data->overview)) |
|
| 172 | + { |
|
| 164 | 173 | return $this->data->overview; |
| 165 | 174 | } |
| 166 | 175 | return ''; |
@@ -172,7 +181,8 @@ discard block |
||
| 172 | 181 | */ |
| 173 | 182 | public function getProductionCode() : string |
| 174 | 183 | { |
| 175 | - if (isset($this->data->production_code)) { |
|
| 184 | + if (isset($this->data->production_code)) |
|
| 185 | + { |
|
| 176 | 186 | return $this->data->production_code; |
| 177 | 187 | } |
| 178 | 188 | return ''; |
@@ -184,7 +194,8 @@ discard block |
||
| 184 | 194 | */ |
| 185 | 195 | public function getSeasonNumber() : int |
| 186 | 196 | { |
| 187 | - if (isset($this->data->season_number)) { |
|
| 197 | + if (isset($this->data->season_number)) |
|
| 198 | + { |
|
| 188 | 199 | return (int) $this->data->season_number; |
| 189 | 200 | } |
| 190 | 201 | return 0; |
@@ -196,7 +207,8 @@ discard block |
||
| 196 | 207 | */ |
| 197 | 208 | public function getStillPath() : string |
| 198 | 209 | { |
| 199 | - if (isset($this->data->still_path)) { |
|
| 210 | + if (isset($this->data->still_path)) |
|
| 211 | + { |
|
| 200 | 212 | return $this->data->still_path; |
| 201 | 213 | } |
| 202 | 214 | return ''; |
@@ -210,7 +222,8 @@ discard block |
||
| 210 | 222 | { |
| 211 | 223 | $data = $this->tmdb->getRequest('tv/' . $this->tv_id . '/season/' . $this->season_number . '/episode/' . $this->episode_number . '/images', $this->params); |
| 212 | 224 | |
| 213 | - foreach ($data->stills as $b) { |
|
| 225 | + foreach ($data->stills as $b) |
|
| 226 | + { |
|
| 214 | 227 | $image = new Results\Image($this->tmdb, $this->id, $b); |
| 215 | 228 | yield $image; |
| 216 | 229 | } |
@@ -119,12 +119,14 @@ |
||
| 119 | 119 | */ |
| 120 | 120 | private function getImage(string $type, string $size, string $filepath) : string |
| 121 | 121 | { |
| 122 | - if (!isset($this->conf->images->base_url)) { |
|
| 122 | + if (!isset($this->conf->images->base_url)) |
|
| 123 | + { |
|
| 123 | 124 | $this->logger->error('No image base url found from configuration'); |
| 124 | 125 | throw new NotFoundException; |
| 125 | 126 | } |
| 126 | 127 | $sizes = $type . '_sizes'; |
| 127 | - if (!in_array($size, $this->conf->images->$sizes)) { |
|
| 128 | + if (!in_array($size, $this->conf->images->$sizes)) |
|
| 129 | + { |
|
| 128 | 130 | $this->logger->error('Incorrect param image size', array('type' => $type, 'size' => $size, 'filepath' => $filepath)); |
| 129 | 131 | throw new IncorrectParamException; |
| 130 | 132 | } |
@@ -92,7 +92,8 @@ |
||
| 92 | 92 | */ |
| 93 | 93 | public function checkDependency(BuilderInterface $builder) : bool |
| 94 | 94 | { |
| 95 | - if (!class_exists($builder->getMainClassName())) { |
|
| 95 | + if (!class_exists($builder->getMainClassName())) |
|
| 96 | + { |
|
| 96 | 97 | $message = "missing {$builder->getPackageName()}, please install it using composer : composer require {$builder->getPackageName()}"; |
| 97 | 98 | throw new MissingDependencyException($message); |
| 98 | 99 | } |
@@ -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 | } |
@@ -30,8 +30,10 @@ |
||
| 30 | 30 | */ |
| 31 | 31 | public function getCrew() : \Generator |
| 32 | 32 | { |
| 33 | - if (!empty($this->data->crew)) { |
|
| 34 | - foreach ($this->data->crew as $crew) { |
|
| 33 | + if (!empty($this->data->crew)) |
|
| 34 | + { |
|
| 35 | + foreach ($this->data->crew as $crew) |
|
| 36 | + { |
|
| 35 | 37 | $crew->gender = null; |
| 36 | 38 | |
| 37 | 39 | $return = new Results\Crew($this->tmdb, $crew); |