@@ -29,10 +29,8 @@ |
||
29 | 29 | */ |
30 | 30 | public function getCrew() |
31 | 31 | { |
32 | - if (!empty($this->data->crew)) |
|
33 | - { |
|
34 | - foreach ($this->data->crew as $crew) |
|
35 | - { |
|
32 | + if (!empty($this->data->crew)) { |
|
33 | + foreach ($this->data->crew as $crew) { |
|
36 | 34 | $crew->gender = null; |
37 | 35 | |
38 | 36 | $return = new Crew($this->tmdb, $crew); |
@@ -50,18 +50,14 @@ |
||
50 | 50 | */ |
51 | 51 | public function getResponse($url) |
52 | 52 | { |
53 | - try |
|
54 | - { |
|
53 | + try { |
|
55 | 54 | return $this->guzzleClient->request('GET', $url); |
56 | 55 | } |
57 | - catch (RequestException $e) |
|
58 | - { |
|
59 | - if (is_null($e->getResponse())) |
|
60 | - { |
|
56 | + catch (RequestException $e) { |
|
57 | + if (is_null($e->getResponse())) { |
|
61 | 58 | throw new HttpErrorException; |
62 | 59 | } |
63 | - switch ((int) $e->getResponse()->getStatusCode()) |
|
64 | - { |
|
60 | + switch ((int) $e->getResponse()->getStatusCode()) { |
|
65 | 61 | case 404: |
66 | 62 | throw new NotFoundException($e->getMessage()); |
67 | 63 | default: |
@@ -74,12 +74,10 @@ discard block |
||
74 | 74 | */ |
75 | 75 | private function searchItem($item, $query, array $options, $result_class) |
76 | 76 | { |
77 | - try |
|
78 | - { |
|
77 | + try { |
|
79 | 78 | $this->logger->debug('Starting search item'); |
80 | 79 | $query = trim($query); |
81 | - if (empty($query)) |
|
82 | - { |
|
80 | + if (empty($query)) { |
|
83 | 81 | $this->logger->error('Query param cannot be empty', array('item' => $item, 'query' => $query, 'options' => $options, 'result_class' => $result_class)); |
84 | 82 | throw new IncorrectParamException; |
85 | 83 | } |
@@ -92,8 +90,7 @@ discard block |
||
92 | 90 | |
93 | 91 | return $this->searchItemGenerator($response->results, $result_class); |
94 | 92 | } |
95 | - catch (TmdbException $ex) |
|
96 | - { |
|
93 | + catch (TmdbException $ex) { |
|
97 | 94 | throw $ex; |
98 | 95 | } |
99 | 96 | } |
@@ -106,8 +103,7 @@ discard block |
||
106 | 103 | private function searchItemGenerator(array $results, $class) |
107 | 104 | { |
108 | 105 | $this->logger->debug('Starting search item generator'); |
109 | - foreach ($results as $result) |
|
110 | - { |
|
106 | + foreach ($results as $result) { |
|
111 | 107 | $element = new $class($this->tmdb, $result); |
112 | 108 | |
113 | 109 | yield $element; |
@@ -123,13 +119,11 @@ discard block |
||
123 | 119 | */ |
124 | 120 | public function movie($query, array $options = array()) |
125 | 121 | { |
126 | - try |
|
127 | - { |
|
122 | + try { |
|
128 | 123 | $this->logger->debug('Starting search movie'); |
129 | 124 | return $this->searchItem('movie', $query, $options, Results\Movie::class); |
130 | 125 | } |
131 | - catch (TmdbException $ex) |
|
132 | - { |
|
126 | + catch (TmdbException $ex) { |
|
133 | 127 | throw $ex; |
134 | 128 | } |
135 | 129 | } |
@@ -143,13 +137,11 @@ discard block |
||
143 | 137 | */ |
144 | 138 | public function tvshow($query, array $options = array()) |
145 | 139 | { |
146 | - try |
|
147 | - { |
|
140 | + try { |
|
148 | 141 | $this->logger->debug('Starting search tv show'); |
149 | 142 | return $this->searchItem('tv', $query, $options, Results\TVShow::class); |
150 | 143 | } |
151 | - catch (TmdbException $ex) |
|
152 | - { |
|
144 | + catch (TmdbException $ex) { |
|
153 | 145 | throw $ex; |
154 | 146 | } |
155 | 147 | } |
@@ -163,13 +155,11 @@ discard block |
||
163 | 155 | */ |
164 | 156 | public function collection($query, array $options = array()) |
165 | 157 | { |
166 | - try |
|
167 | - { |
|
158 | + try { |
|
168 | 159 | $this->logger->debug('Starting search collection'); |
169 | 160 | return $this->searchItem('collection', $query, $options, Results\Collection::class); |
170 | 161 | } |
171 | - catch (TmdbException $ex) |
|
172 | - { |
|
162 | + catch (TmdbException $ex) { |
|
173 | 163 | throw $ex; |
174 | 164 | } |
175 | 165 | } |
@@ -183,13 +173,11 @@ discard block |
||
183 | 173 | */ |
184 | 174 | public function people($query, array $options = array()) |
185 | 175 | { |
186 | - try |
|
187 | - { |
|
176 | + try { |
|
188 | 177 | $this->logger->debug('Starting search people'); |
189 | 178 | return $this->searchItem('people', $query, $options, Results\People::class); |
190 | 179 | } |
191 | - catch (TmdbException $ex) |
|
192 | - { |
|
180 | + catch (TmdbException $ex) { |
|
193 | 181 | throw $ex; |
194 | 182 | } |
195 | 183 | } |
@@ -203,13 +191,11 @@ discard block |
||
203 | 191 | */ |
204 | 192 | public function company($query, array $options = array()) |
205 | 193 | { |
206 | - try |
|
207 | - { |
|
194 | + try { |
|
208 | 195 | $this->logger->debug('Starting search company'); |
209 | 196 | return $this->searchItem('people', $query, $options, Results\Company::class); |
210 | 197 | } |
211 | - catch (TmdbException $ex) |
|
212 | - { |
|
198 | + catch (TmdbException $ex) { |
|
213 | 199 | throw $ex; |
214 | 200 | } |
215 | 201 | } |