@@ -188,11 +188,9 @@ |
||
188 | 188 | |
189 | 189 | // $this->addRequestParameters($request, $query, $postFields, $files); |
190 | 190 | // $response = $request->send(); |
191 | - } |
|
192 | - catch (GuzzleBadResponse $e) { |
|
191 | + } catch (GuzzleBadResponse $e) { |
|
193 | 192 | throw BadResponseException::fromGuzzleResponse($e); |
194 | - } |
|
195 | - catch (GuzzleException $e) { |
|
193 | + } catch (GuzzleException $e) { |
|
196 | 194 | throw new RuntimeException($e->getMessage(), $e->getCode(), $e); |
197 | 195 | } |
198 | 196 |
@@ -67,8 +67,7 @@ |
||
67 | 67 | { |
68 | 68 | try { |
69 | 69 | $response = $this->getAdapter()->call($method, $path, $query, $postFields, array(), $headers); |
70 | - } |
|
71 | - catch (BadResponseException $e) { |
|
70 | + } catch (BadResponseException $e) { |
|
72 | 71 | $statusCode = $e->getStatusCode(); |
73 | 72 | switch ($statusCode) { |
74 | 73 | case 404: |
@@ -12,7 +12,6 @@ |
||
12 | 12 | namespace PhraseanetSDK\Entity; |
13 | 13 | |
14 | 14 | use DateTime; |
15 | -use DateTimeInterface; |
|
16 | 15 | use Doctrine\Common\Collections\ArrayCollection; |
17 | 16 | use Exception; |
18 | 17 | use stdClass; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function getId(): string |
113 | 113 | { |
114 | - return $this->getDataboxId() . '_' . $this->getRecordId(); |
|
114 | + return $this->getDataboxId().'_'.$this->getRecordId(); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | public function getThumbnail(): ?Subdef |
226 | 226 | { |
227 | - if (! isset($this->source->thumbnail)) { |
|
227 | + if (!isset($this->source->thumbnail)) { |
|
228 | 228 | return null; |
229 | 229 | } |
230 | 230 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function getTechnicalInformation() |
260 | 260 | { |
261 | - if (! isset($this->source->technical_informations)) { |
|
261 | + if (!isset($this->source->technical_informations)) { |
|
262 | 262 | $this->technicalInformation = new ArrayCollection(); |
263 | 263 | } |
264 | 264 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | */ |
275 | 275 | public function getSubdefs() |
276 | 276 | { |
277 | - if (! isset($this->source->subdefs)) { |
|
277 | + if (!isset($this->source->subdefs)) { |
|
278 | 278 | $this->subdefs = new ArrayCollection(); |
279 | 279 | } |
280 | 280 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | */ |
287 | 287 | public function getStatus() |
288 | 288 | { |
289 | - if (! isset($this->source->status)) { |
|
289 | + if (!isset($this->source->status)) { |
|
290 | 290 | $this->status = new ArrayCollection(); |
291 | 291 | } |
292 | 292 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | */ |
299 | 299 | public function getCaption() |
300 | 300 | { |
301 | - if (! isset($this->source->caption)) { |
|
301 | + if (!isset($this->source->caption)) { |
|
302 | 302 | $this->caption = new ArrayCollection(); |
303 | 303 | } |
304 | 304 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | */ |
311 | 311 | public function getMetadata() |
312 | 312 | { |
313 | - if (! isset($this->source->metadata)) { |
|
313 | + if (!isset($this->source->metadata)) { |
|
314 | 314 | $this->metadata = new ArrayCollection(); |
315 | 315 | } |
316 | 316 |
@@ -16,7 +16,6 @@ |
||
16 | 16 | use PhraseanetSDK\Exception\NotFoundException; |
17 | 17 | use PhraseanetSDK\Exception\RuntimeException; |
18 | 18 | use Doctrine\Common\Collections\ArrayCollection; |
19 | -use PhraseanetSDK\EntityHydrator; |
|
20 | 19 | use PhraseanetSDK\Exception\TokenExpiredException; |
21 | 20 | use PhraseanetSDK\Exception\UnauthorizedException; |
22 | 21 |
@@ -15,7 +15,6 @@ |
||
15 | 15 | use PhraseanetSDK\Exception\NotFoundException; |
16 | 16 | use PhraseanetSDK\Exception\RuntimeException; |
17 | 17 | use Doctrine\Common\Collections\ArrayCollection; |
18 | -use PhraseanetSDK\EntityHydrator; |
|
19 | 18 | use PhraseanetSDK\Exception\TokenExpiredException; |
20 | 19 | use PhraseanetSDK\Exception\UnauthorizedException; |
21 | 20 | use PhraseanetSDK\Entity\Quarantine as QuarantineEntity; |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function requestPasswordReset(string $emailAddress): string |
95 | 95 | { |
96 | - $response = $this->query('POST', 'v1/accounts/reset-password/' . urlencode($emailAddress) . '/'); |
|
96 | + $response = $this->query('POST', 'v1/accounts/reset-password/'.urlencode($emailAddress).'/'); |
|
97 | 97 | |
98 | 98 | if (!$response->hasProperty('reset_token')) { |
99 | 99 | throw new RuntimeException('Missing "token" property in response content'); |
100 | 100 | } |
101 | 101 | |
102 | - return (string)$response->getProperty('reset_token'); |
|
102 | + return (string) $response->getProperty('reset_token'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function resetPassword(string $token, string $password): bool |
115 | 115 | { |
116 | - $response = $this->query('POST', 'v1/accounts/update-password/' . $token . '/', array(), array( |
|
116 | + $response = $this->query('POST', 'v1/accounts/update-password/'.$token.'/', array(), array( |
|
117 | 117 | 'password' => $password |
118 | 118 | )); |
119 | 119 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | throw new RuntimeException('Missing "success" property in response content'); |
122 | 122 | } |
123 | 123 | |
124 | - return (bool)$response->getProperty('success'); |
|
124 | + return (bool) $response->getProperty('success'); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | throw new RuntimeException('Missing "success" property in response content'); |
147 | 147 | } |
148 | 148 | |
149 | - return (bool)$response->getProperty('success'); |
|
149 | + return (bool) $response->getProperty('success'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | throw new RuntimeException('Missing "token" property in response content'); |
194 | 194 | } |
195 | 195 | |
196 | - return (string)$response->getProperty('token'); |
|
196 | + return (string) $response->getProperty('token'); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | public function updateUser(UserEntity $user) |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | throw new RuntimeException('Missing "success" property in response content'); |
223 | 223 | } |
224 | 224 | |
225 | - return (bool)$response->getProperty('success'); |
|
225 | + return (bool) $response->getProperty('success'); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | /** |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function unlockAccount(string $token): bool |
246 | 246 | { |
247 | - $response = $this->query('POST', 'v1/accounts/unlock/' . $token . '/'); |
|
247 | + $response = $this->query('POST', 'v1/accounts/unlock/'.$token.'/'); |
|
248 | 248 | |
249 | 249 | if (!$response->hasProperty('success')) { |
250 | 250 | throw new \RuntimeException('Missing "success" property in response content'); |
251 | 251 | } |
252 | 252 | |
253 | - return (bool)$response->getProperty('success'); |
|
253 | + return (bool) $response->getProperty('success'); |
|
254 | 254 | } |
255 | 255 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * Search for records |
85 | 85 | * |
86 | 86 | * @param array $parameters Query parameters |
87 | - * @param int $pAPINumber API number (e.g. 3) |
|
87 | + * @param int $pAPINumber API number (e.g. 3) |
|
88 | 88 | * @return QueryEntity object |
89 | 89 | * @throws RuntimeException |
90 | 90 | * @throws UnauthorizedException |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function search(array $parameters = [], int $pAPINumber = 1): QueryEntity |
95 | 95 | { |
96 | - $response = $this->query('POST', 'v'.$pAPINumber.'/search/', [], array_merge( |
|
96 | + $response = $this->query('POST', 'v'.$pAPINumber.'/search/', [], array_merge( |
|
97 | 97 | ['search_type' => 0], |
98 | 98 | $parameters |
99 | 99 | )); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * Search for stories |
79 | 79 | * |
80 | 80 | * @param array $parameters Query parameters |
81 | - * @param int $pAPINumber API number (e.g. 3) |
|
81 | + * @param int $pAPINumber API number (e.g. 3) |
|
82 | 82 | * @return QueryEntity object |
83 | 83 | * @throws RuntimeException |
84 | 84 | * @throws UnauthorizedException |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | { |
90 | 90 | $response = $this->query('POST', 'v'.$pAPINumber.'/search/', array(), array_merge( |
91 | 91 | $parameters, |
92 | - array('search_type' => SearchResult::TYPE_STORY) |
|
92 | + array('search_type' => SearchResult::TYPE_STORY) |
|
93 | 93 | )); |
94 | 94 | |
95 | 95 | if ($response->isEmpty()) { |
@@ -105,8 +105,7 @@ |
||
105 | 105 | ); |
106 | 106 | $data = json_decode($responseContent, true); |
107 | 107 | $token = $data["access_token"]; |
108 | - } |
|
109 | - catch (BadResponseException $e) { |
|
108 | + } catch (BadResponseException $e) { |
|
110 | 109 | $response = json_decode($e->getResponseBody(), true); |
111 | 110 | $msg = isset($response['error']) ? $response['error'] : (isset($response['msg']) ? $response['msg'] : ''); |
112 | 111 |