@@ -1,4 +1,4 @@ |
||
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 | * |
@@ -61,7 +61,8 @@ |
||
61 | 61 | ]); |
62 | 62 | |
63 | 63 | return $this->guzzleClient->request($method, $url, $params); |
64 | - } catch (RequestException $e) { |
|
64 | + } |
|
65 | + catch (RequestException $e) { |
|
65 | 66 | if (is_null($e->getResponse())) { |
66 | 67 | throw new HttpErrorException; |
67 | 68 | } |
@@ -156,7 +156,8 @@ discard block |
||
156 | 156 | $this->tmdb->postRequest($action, $this->options, $params); |
157 | 157 | |
158 | 158 | return $this; |
159 | - } catch (TmdbException $e) { |
|
159 | + } |
|
160 | + catch (TmdbException $e) { |
|
160 | 161 | throw $e; |
161 | 162 | } |
162 | 163 | } |
@@ -172,7 +173,8 @@ discard block |
||
172 | 173 | $this->tmdb->deleteRequest($action, $this->options); |
173 | 174 | |
174 | 175 | return $this; |
175 | - } catch (TmdbException $e) { |
|
176 | + } |
|
177 | + catch (TmdbException $e) { |
|
176 | 178 | throw $e; |
177 | 179 | } |
178 | 180 | } |
@@ -1,4 +1,4 @@ discard block |
||
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 | * |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function addMovieRate(int $movie_id, float $rate) : Rated |
66 | 66 | { |
67 | - return $this->addRate('movie/'.$movie_id.'/rating', $rate); |
|
67 | + return $this->addRate('movie/' . $movie_id . '/rating', $rate); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function removeMovieRate(int $movie_id) : Rated |
76 | 76 | { |
77 | - return $this->removeRate('movie/'.$movie_id.'/rating'); |
|
77 | + return $this->removeRate('movie/' . $movie_id . '/rating'); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function addTVShowRate(int $tv_id, float $rate) : Rated |
87 | 87 | { |
88 | - return $this->addRate('tv/'.$tv_id.'/rating', $rate); |
|
88 | + return $this->addRate('tv/' . $tv_id . '/rating', $rate); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function removeTVShowRate(int $tv_id) : Rated |
97 | 97 | { |
98 | - return $this->removeRate('tv/'.$tv_id.'/rating'); |
|
98 | + return $this->removeRate('tv/' . $tv_id . '/rating'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function addTVShowEpisodeRate(int $tv_id, int $season_number, int $episode_number, float $rate) : Rated |
110 | 110 | { |
111 | - return $this->addRate('tv/'.$tv_id.'/season/'.$season_number.'/episode/'.$episode_number.'/rating', $rate); |
|
111 | + return $this->addRate('tv/' . $tv_id . '/season/' . $season_number . '/episode/' . $episode_number . '/rating', $rate); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function removeTVShowEpisodeRate(int $tv_id, int $season_number, int $episode_number) : Rated |
122 | 122 | { |
123 | - return $this->removeRate('tv/'.$tv_id.'/season/'.$season_number.'/episode/'.$episode_number.'/rating'); |
|
123 | + return $this->removeRate('tv/' . $tv_id . '/season/' . $season_number . '/episode/' . $episode_number . '/rating'); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -79,7 +79,8 @@ discard block |
||
79 | 79 | $this->total_results = (int) $response->total_results; |
80 | 80 | |
81 | 81 | return $this->searchItemGenerator($response->results, $result_class); |
82 | - } catch (TmdbException $ex) { |
|
82 | + } |
|
83 | + catch (TmdbException $ex) { |
|
83 | 84 | throw $ex; |
84 | 85 | } |
85 | 86 | } |
@@ -96,7 +97,8 @@ discard block |
||
96 | 97 | try { |
97 | 98 | $this->logger->debug('Starting search movie', array('query' => $query, 'options' => $options)); |
98 | 99 | return $this->searchItem('movie', $query, $options, Results\Movie::class); |
99 | - } catch (TmdbException $ex) { |
|
100 | + } |
|
101 | + catch (TmdbException $ex) { |
|
100 | 102 | throw $ex; |
101 | 103 | } |
102 | 104 | } |
@@ -113,7 +115,8 @@ discard block |
||
113 | 115 | try { |
114 | 116 | $this->logger->debug('Starting search tv show', array('query' => $query, 'options' => $options)); |
115 | 117 | return $this->searchItem('tv', $query, $options, Results\TVShow::class); |
116 | - } catch (TmdbException $ex) { |
|
118 | + } |
|
119 | + catch (TmdbException $ex) { |
|
117 | 120 | throw $ex; |
118 | 121 | } |
119 | 122 | } |
@@ -130,7 +133,8 @@ discard block |
||
130 | 133 | try { |
131 | 134 | $this->logger->debug('Starting search collection', array('query' => $query, 'options' => $options)); |
132 | 135 | return $this->searchItem('collection', $query, $options, Results\Collection::class); |
133 | - } catch (TmdbException $ex) { |
|
136 | + } |
|
137 | + catch (TmdbException $ex) { |
|
134 | 138 | throw $ex; |
135 | 139 | } |
136 | 140 | } |
@@ -147,7 +151,8 @@ discard block |
||
147 | 151 | try { |
148 | 152 | $this->logger->debug('Starting search people', array('query' => $query, 'options' => $options)); |
149 | 153 | return $this->searchItem('person', $query, $options, Results\People::class); |
150 | - } catch (TmdbException $ex) { |
|
154 | + } |
|
155 | + catch (TmdbException $ex) { |
|
151 | 156 | throw $ex; |
152 | 157 | } |
153 | 158 | } |
@@ -164,7 +169,8 @@ discard block |
||
164 | 169 | try { |
165 | 170 | $this->logger->debug('Starting search company', array('query' => $query, 'options' => $options)); |
166 | 171 | return $this->searchItem('company', $query, $options, Results\Company::class); |
167 | - } catch (TmdbException $ex) { |
|
172 | + } |
|
173 | + catch (TmdbException $ex) { |
|
168 | 174 | throw $ex; |
169 | 175 | } |
170 | 176 | } |
@@ -1,4 +1,4 @@ discard block |
||
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 | * |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | private function checkSearchItemOption(array $options) : array |
95 | 95 | { |
96 | - $params = []; |
|
96 | + $params = []; |
|
97 | 97 | $this->tmdb->checkOptionQuery($options, $params); |
98 | 98 | $this->tmdb->checkOptionPage($options, $params); |
99 | 99 | $this->tmdb->checkOptionLanguage($options, $params); |
@@ -1,4 +1,4 @@ |
||
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,8 @@ |
||
35 | 35 | $this->cast_class = PeopleMovieCast::class; |
36 | 36 | |
37 | 37 | parent::__construct($tmdb, 'movie', $people_id, $options); |
38 | - } catch (TmdbException $ex) { |
|
38 | + } |
|
39 | + catch (TmdbException $ex) { |
|
39 | 40 | throw $ex; |
40 | 41 | } |
41 | 42 | } |
@@ -26,17 +26,17 @@ |
||
26 | 26 | * @author Vincent Faliès <[email protected]> |
27 | 27 | * @copyright Copyright (c) 2017 |
28 | 28 | */ |
29 | - class PeopleTVShowCredit extends PeopleItemCredit |
|
30 | - { |
|
31 | - public function __construct(TmdbInterface $tmdb, int $people_id, array $options = array()) |
|
32 | - { |
|
33 | - try { |
|
34 | - $this->crew_class = PeopleTVShowCrew::class; |
|
35 | - $this->cast_class = PeopleTVShowCast::class; |
|
29 | + class PeopleTVShowCredit extends PeopleItemCredit |
|
30 | + { |
|
31 | + public function __construct(TmdbInterface $tmdb, int $people_id, array $options = array()) |
|
32 | + { |
|
33 | + try { |
|
34 | + $this->crew_class = PeopleTVShowCrew::class; |
|
35 | + $this->cast_class = PeopleTVShowCast::class; |
|
36 | 36 | |
37 | - parent::__construct($tmdb, 'tv', $people_id, $options); |
|
38 | - } catch (TmdbException $ex) { |
|
39 | - throw $ex; |
|
40 | - } |
|
41 | - } |
|
42 | - } |
|
37 | + parent::__construct($tmdb, 'tv', $people_id, $options); |
|
38 | + } catch (TmdbException $ex) { |
|
39 | + throw $ex; |
|
40 | + } |
|
41 | + } |
|
42 | + } |
@@ -1,4 +1,4 @@ |
||
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,8 @@ |
||
35 | 35 | $this->cast_class = PeopleTVShowCast::class; |
36 | 36 | |
37 | 37 | parent::__construct($tmdb, 'tv', $people_id, $options); |
38 | - } catch (TmdbException $ex) { |
|
38 | + } |
|
39 | + catch (TmdbException $ex) { |
|
39 | 40 | throw $ex; |
40 | 41 | } |
41 | 42 | } |
@@ -1,4 +1,4 @@ |
||
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 | * |
@@ -56,7 +56,6 @@ |
||
56 | 56 | return $this->setListItem('favorite', 'movie', $movie_id, true); |
57 | 57 | } |
58 | 58 | /** |
59 | - |
|
60 | 59 | * Unmark a movie as favorite |
61 | 60 | * @param int $movie_id Movie id |
62 | 61 | * @return Favorite |
@@ -1,4 +1,4 @@ |
||
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 | * |
@@ -95,7 +95,8 @@ |
||
95 | 95 | $this->tmdb->postRequest('account/'.$this->account_id.'/'.$list_type, $this->options, $params); |
96 | 96 | |
97 | 97 | return $this; |
98 | - } catch (TmdbException $e) { |
|
98 | + } |
|
99 | + catch (TmdbException $e) { |
|
99 | 100 | throw $e; |
100 | 101 | } |
101 | 102 | } |
@@ -1,4 +1,4 @@ discard block |
||
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 | * |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $params['media_id'] = $media_id; |
110 | 110 | $params[$list_type] = $add; |
111 | 111 | |
112 | - $this->tmdb->postRequest('account/'.$this->account_id.'/'.$list_type, $this->options, $params); |
|
112 | + $this->tmdb->postRequest('account/' . $this->account_id . '/' . $list_type, $this->options, $params); |
|
113 | 113 | |
114 | 114 | return $this; |
115 | 115 | } catch (TmdbException $e) { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $this->tmdb->checkOptionSortBy($this->options, $options); |
133 | 133 | $this->tmdb->checkOptionPage($this->options, $options); |
134 | 134 | |
135 | - $response = $this->tmdb->getRequest('account/'.$this->account_id.'/'.$list_type.'/'.$item, $options); |
|
135 | + $response = $this->tmdb->getRequest('account/' . $this->account_id . '/' . $list_type . '/' . $item, $options); |
|
136 | 136 | |
137 | 137 | $this->page = (int) $response->page; |
138 | 138 | $this->total_pages = (int) $response->total_pages; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * Send request to TMDB API with GET method |
121 | 121 | * @param string $action API action to request |
122 | 122 | * @param array $options Array of options of the request (optional) |
123 | - * @return \stdClass|null |
|
123 | + * @return string |
|
124 | 124 | */ |
125 | 125 | public function getRequest(string $action, array $options = array()) : ?\stdClass |
126 | 126 | { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param string $action API action to request |
135 | 135 | * @param array $options Array of options of the request (optional) |
136 | 136 | * @param array $form_params form_params for request options |
137 | - * @return \stdClass|null |
|
137 | + * @return string |
|
138 | 138 | */ |
139 | 139 | public function postRequest(string $action, array $options = array(), array $form_params = array()) : ?\stdClass |
140 | 140 | { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * Send request to TMDB API with DELETE method |
148 | 148 | * @param string $action API action to request |
149 | 149 | * @param array $options Array of options of the request (optional) |
150 | - * @return \stdClass|null |
|
150 | + * @return string |
|
151 | 151 | */ |
152 | 152 | public function deleteRequest(string $action, array $options = array()) : ?\stdClass |
153 | 153 | { |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * @param string $method HTTP method (GET, POST) |
162 | 162 | * @param string $url API url to request |
163 | 163 | * @param array $form_params form params request options |
164 | - * @return \stdClass|null |
|
164 | + * @return string |
|
165 | 165 | */ |
166 | 166 | protected function sendRequest(string $method, string $url, array $form_params = array()) : ?\stdClass |
167 | 167 | { |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * This file is part of the Tmdb package. |
@@ -167,12 +167,12 @@ discard block |
||
167 | 167 | { |
168 | 168 | try { |
169 | 169 | $res = new \stdClass(); |
170 | - $method_name = $method.'Response'; |
|
170 | + $method_name = $method . 'Response'; |
|
171 | 171 | $res = $this->http_request->$method_name($url, [], $form_params); |
172 | 172 | $response = $this->decodeRequest($res, $method, $url, $form_params); |
173 | 173 | return $response; |
174 | 174 | } catch (TmdbException $e) { |
175 | - $this->logger->error('sendRequest failed : '.$e->getMessage(), array('method' => $method, 'url' => $url, 'form_params' => $form_params)); |
|
175 | + $this->logger->error('sendRequest failed : ' . $e->getMessage(), array('method' => $method, 'url' => $url, 'form_params' => $form_params)); |
|
176 | 176 | throw $e; |
177 | 177 | } |
178 | 178 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | default: |
339 | 339 | throw new IncorrectParamException; |
340 | 340 | } |
341 | - $return['sort_by'] = 'created_at.'.$options['sort_by']; |
|
341 | + $return['sort_by'] = 'created_at.' . $options['sort_by']; |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 |
@@ -171,7 +171,8 @@ discard block |
||
171 | 171 | $res = $this->http_request->$method_name($url, [], $form_params); |
172 | 172 | $response = $this->decodeRequest($res, $method, $url, $form_params); |
173 | 173 | return $response; |
174 | - } catch (TmdbException $e) { |
|
174 | + } |
|
175 | + catch (TmdbException $e) { |
|
175 | 176 | $this->logger->error('sendRequest failed : '.$e->getMessage(), array('method' => $method, 'url' => $url, 'form_params' => $form_params)); |
176 | 177 | throw $e; |
177 | 178 | } |
@@ -236,7 +237,8 @@ discard block |
||
236 | 237 | $this->configuration = $this->getRequest('configuration'); |
237 | 238 | } |
238 | 239 | return $this->configuration; |
239 | - } catch (TmdbException $ex) { |
|
240 | + } |
|
241 | + catch (TmdbException $ex) { |
|
240 | 242 | throw $ex; |
241 | 243 | } |
242 | 244 | } |