Passed
Branch account (e36184)
by vincent
07:24
created
src/VfacTmdb/Account.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,6 @@
 block discarded – undo
20 20
 use VfacTmdb\Exceptions\ServerErrorException;
21 21
 use VfacTmdb\Interfaces\TmdbInterface;
22 22
 use VfacTmdb\Account\Favorite;
23
-
24 23
 use VfacTmdb\Interfaces\AuthInterface;
25 24
 
26 25
 /**
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,7 +67,8 @@  discard block
 block discarded – undo
67 67
         $this->tmdb   = $tmdb;
68 68
         $this->logger = $tmdb->getLogger();
69 69
 
70
-        if (trim($auth->session_id) == '') {
70
+        if (trim($auth->session_id) == '')
71
+        {
71 72
             throw new ServerErrorException('No account session found');
72 73
         }
73 74
         $this->auth = $auth;
@@ -75,7 +76,8 @@  discard block
 block discarded – undo
75 76
 
76 77
         // Get details account
77 78
         $this->data       = $this->tmdb->getRequest('account', array('session_id' => $this->auth->session_id));
78
-        if (!isset($this->data->id)) {
79
+        if (!isset($this->data->id))
80
+        {
79 81
             throw new ServerErrorException('Invalid response for details account');
80 82
         }
81 83
         $this->account_id = $this->data->id;
Please login to merge, or discard this patch.
src/VfacTmdb/Auth.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,6 @@
 block discarded – undo
18 18
 use VfacTmdb\Exceptions\IncorrectParamException;
19 19
 use VfacTmdb\Interfaces\TmdbInterface;
20 20
 use VfacTmdb\Interfaces\AuthInterface;
21
-
22 21
 use VfacTmdb\Exceptions\InvalidResponseException;
23 22
 
24 23
 /**
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -74,8 +74,10 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $this->getRequestToken();
76 76
         $url = "https://www.themoviedb.org/authenticate/$this->request_token";
77
-        if (!is_null($redirect_url)) {
78
-            if (!filter_var($redirect_url, FILTER_VALIDATE_URL)) {
77
+        if (!is_null($redirect_url))
78
+        {
79
+            if (!filter_var($redirect_url, FILTER_VALIDATE_URL))
80
+            {
79 81
                 throw new IncorrectParamException('Invalid redirect Url');
80 82
             }
81 83
             $url .= "?redirect_to=$redirect_url";
@@ -92,7 +94,8 @@  discard block
 block discarded – undo
92 94
     {
93 95
         $data = $this->tmdb->getRequest('authentification/token/new', []);
94 96
 
95
-        if (!isset($data->success) || $data->success != 'true' || !isset($data->request_token)) {
97
+        if (!isset($data->success) || $data->success != 'true' || !isset($data->request_token))
98
+        {
96 99
             throw new InvalidResponseException("Getting request token failed");
97 100
         }
98 101
         $this->request_token            = $data->request_token;
@@ -107,7 +110,8 @@  discard block
 block discarded – undo
107 110
     {
108 111
         $data = $this->tmdb->getRequest('authentification/session/new', ['request_token' => $this->request_token]);
109 112
 
110
-        if (!isset($data->success) || $data->success != 'true' || !isset($data->session_id)) {
113
+        if (!isset($data->success) || $data->success != 'true' || !isset($data->session_id))
114
+        {
111 115
             throw new InvalidResponseException("Creating session failed");
112 116
         }
113 117
         $this->session_id = $data->session_id;
@@ -120,7 +124,8 @@  discard block
 block discarded – undo
120 124
      */
121 125
     public function __get(string $name)
122 126
     {
123
-        switch ($name) {
127
+        switch ($name)
128
+        {
124 129
           case 'request_token':
125 130
           case 'session_id':
126 131
               return $this->$name;
Please login to merge, or discard this patch.
src/VfacTmdb/Catalogs/Genres.php 1 patch
Braces   +19 added lines, -8 removed lines patch added patch discarded remove patch
@@ -51,9 +51,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/VfacTmdb/Catalogs/Jobs.php 1 patch
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,13 +50,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/VfacTmdb/Factory/Builder/MonologBuilder.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/VfacTmdb/Results/PeopleTVShowCrew.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,8 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/VfacTmdb/Results/TVEpisode.php 1 patch
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -96,13 +96,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/VfacTmdb/Items/TVShow.php 1 patch
Braces   +32 added lines, -16 removed lines patch added patch discarded remove patch
@@ -56,7 +56,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/VfacTmdb/Items/MovieCredit.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,8 +51,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
             }
Please login to merge, or discard this patch.