Passed
Branch account (733a83)
by vincent
02:35
created
src/VfacTmdb/Traits/ElementTrait.php 2 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 '';
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
src/VfacTmdb/Abstracts/Item.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,14 +66,17 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
src/VfacTmdb/Abstracts/Results.php 2 patches
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,8 +64,10 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
src/VfacTmdb/Exceptions/HttpErrorException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
src/VfacTmdb/lib/Guzzle/Client.php 2 patches
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,18 +54,23 @@
 block discarded – undo
54 54
      */
55 55
     private function sendResponse(string $method, string $url, array $options = [], array $form_params = array())
56 56
     {
57
-        try {
57
+        try
58
+        {
58 59
             $params = array_merge($options, [
59 60
                 'headers' => ['Content-Type' => 'application/json;charset=utf-8'],
60 61
                 'body' => json_encode($form_params)
61 62
             ]);
62 63
 
63 64
             return $this->guzzleClient->request($method, $url, $params);
64
-        } catch (RequestException $e) {
65
-            if (is_null($e->getResponse())) {
65
+        }
66
+        catch (RequestException $e)
67
+        {
68
+            if (is_null($e->getResponse()))
69
+            {
66 70
                 throw new HttpErrorException;
67 71
             }
68
-            switch ((int) $e->getResponse()->getStatusCode()) {
72
+            switch ((int) $e->getResponse()->getStatusCode())
73
+            {
69 74
                 case 404:
70 75
                     throw new NotFoundException($e->getMessage());
71 76
                 default:
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
src/VfacTmdb/Account/Rated.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
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
  *
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function getMovies() : \Generator
37 37
     {
38
-        $response = $this->tmdb->getRequest('account/'.$this->account_id.'/rated/movies', $this->options);
38
+        $response = $this->tmdb->getRequest('account/' . $this->account_id . '/rated/movies', $this->options);
39 39
 
40 40
         $this->page          = (int) $response->page;
41 41
         $this->total_pages   = (int) $response->total_pages;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function getTVShows() : \Generator
52 52
     {
53
-        $response = $this->tmdb->getRequest('account/'.$this->account_id.'/rated/tv', $this->options);
53
+        $response = $this->tmdb->getRequest('account/' . $this->account_id . '/rated/tv', $this->options);
54 54
 
55 55
         $this->page          = (int) $response->page;
56 56
         $this->total_pages   = (int) $response->total_pages;
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function getTVEpisodes() : \Generator
67 67
     {
68
-        $response = $this->tmdb->getRequest('account/'.$this->account_id.'/rated/tv/episodes', $this->options);
68
+        $response = $this->tmdb->getRequest('account/' . $this->account_id . '/rated/tv/episodes', $this->options);
69 69
 
70 70
         $this->page          = (int) $response->page;
71 71
         $this->total_pages   = (int) $response->total_pages;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function addMovieRate(int $movie_id, float $rate) : Rated
84 84
     {
85
-        return $this->addRate('movie/'.$movie_id.'/rating', $rate);
85
+        return $this->addRate('movie/' . $movie_id . '/rating', $rate);
86 86
     }
87 87
 
88 88
     /**
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function removeMovieRate(int $movie_id) : Rated
94 94
     {
95
-        return $this->removeRate('movie/'.$movie_id.'/rating');
95
+        return $this->removeRate('movie/' . $movie_id . '/rating');
96 96
     }
97 97
 
98 98
     /**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function addTVShowRate(int $tv_id, float $rate) : Rated
105 105
     {
106
-        return $this->addRate('tv/'.$tv_id.'/rating', $rate);
106
+        return $this->addRate('tv/' . $tv_id . '/rating', $rate);
107 107
     }
108 108
 
109 109
     /**
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function removeTVShowRate(int $tv_id) : Rated
115 115
     {
116
-        return $this->removeRate('tv/'.$tv_id.'/rating');
116
+        return $this->removeRate('tv/' . $tv_id . '/rating');
117 117
     }
118 118
 
119 119
     /**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function addTVShowEpisodeRate(int $tv_id, int $season_number, int $episode_number, float $rate) : Rated
128 128
     {
129
-        return $this->addRate('tv/'.$tv_id.'/season/'.$season_number.'/episode/'.$episode_number.'/rating', $rate);
129
+        return $this->addRate('tv/' . $tv_id . '/season/' . $season_number . '/episode/' . $episode_number . '/rating', $rate);
130 130
     }
131 131
 
132 132
     /**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      */
139 139
     public function removeTVShowEpisodeRate(int $tv_id, int $season_number, int $episode_number) : Rated
140 140
     {
141
-        return $this->removeRate('tv/'.$tv_id.'/season/'.$season_number.'/episode/'.$episode_number.'/rating');
141
+        return $this->removeRate('tv/' . $tv_id . '/season/' . $season_number . '/episode/' . $episode_number . '/rating');
142 142
     }
143 143
 
144 144
     /**
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -149,14 +149,17 @@  discard block
 block discarded – undo
149 149
      */
150 150
     private function addRate(string $action, float $rate) : Rated
151 151
     {
152
-        try {
152
+        try
153
+        {
153 154
             $params = [];
154 155
             $params['value'] = $rate;
155 156
 
156 157
             $this->tmdb->postRequest($action, $this->options, $params);
157 158
 
158 159
             return $this;
159
-        } catch (TmdbException $e) {
160
+        }
161
+        catch (TmdbException $e)
162
+        {
160 163
             throw $e;
161 164
         }
162 165
     }
@@ -168,11 +171,14 @@  discard block
 block discarded – undo
168 171
      */
169 172
     private function removeRate(string $action) : Rated
170 173
     {
171
-        try {
174
+        try
175
+        {
172 176
             $this->tmdb->deleteRequest($action, $this->options);
173 177
 
174 178
             return $this;
175
-        } catch (TmdbException $e) {
179
+        }
180
+        catch (TmdbException $e)
181
+        {
176 182
             throw $e;
177 183
         }
178 184
     }
Please login to merge, or discard this patch.
src/VfacTmdb/Account/WatchList.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
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
  *
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
      */
36 36
     public function getMovies() : \Generator
37 37
     {
38
-        $response = $this->tmdb->getRequest('account/'.$this->account_id.'/watchlist/movies', $this->options);
38
+        $response = $this->tmdb->getRequest('account/' . $this->account_id . '/watchlist/movies', $this->options);
39 39
 
40 40
         $this->page          = (int) $response->page;
41 41
         $this->total_pages   = (int) $response->total_pages;
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
      */
51 51
     public function getTVShows() : \Generator
52 52
     {
53
-        $response = $this->tmdb->getRequest('account/'.$this->account_id.'/watchlist/tv', $this->options);
53
+        $response = $this->tmdb->getRequest('account/' . $this->account_id . '/watchlist/tv', $this->options);
54 54
 
55 55
         $this->page          = (int) $response->page;
56 56
         $this->total_pages   = (int) $response->total_pages;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             $params['media_id']   = $media_id;
75 75
             $params['watchlist']  = $watchlist;
76 76
 
77
-            $this->tmdb->postRequest('account/'.$this->account_id.'/watchlist', $this->options, $params);
77
+            $this->tmdb->postRequest('account/' . $this->account_id . '/watchlist', $this->options, $params);
78 78
 
79 79
             return $this;
80 80
         } catch (TmdbException $e) {
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,7 +68,8 @@  discard block
 block discarded – undo
68 68
      */
69 69
     private function setWatchlistItem(string $media_type, int $media_id, bool $watchlist) : WatchList
70 70
     {
71
-        try {
71
+        try
72
+        {
72 73
             $params               = [];
73 74
             $params['media_type'] = $media_type;
74 75
             $params['media_id']   = $media_id;
@@ -77,7 +78,9 @@  discard block
 block discarded – undo
77 78
             $this->tmdb->postRequest('account/'.$this->account_id.'/watchlist', $this->options, $params);
78 79
 
79 80
             return $this;
80
-        } catch (TmdbException $e) {
81
+        }
82
+        catch (TmdbException $e)
83
+        {
81 84
             throw $e;
82 85
         }
83 86
     }
Please login to merge, or discard this patch.
src/VfacTmdb/Account.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,8 @@
 block discarded – undo
68 68
 
69 69
         // Get details account
70 70
         $this->data       = $this->tmdb->getRequest('account', array('session_id' => $this->session_id));
71
-        if (!isset($this->data->id)) {
71
+        if (!isset($this->data->id))
72
+        {
72 73
             throw new ServerErrorException('Invalid response for details account');
73 74
         }
74 75
         $this->account_id = $this->data->id;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.
src/VfacTmdb/Exceptions/IncorrectParamException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
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
  *
Please login to merge, or discard this patch.