@@ -50,18 +50,18 @@ |
||
| 50 | 50 | |
| 51 | 51 | protected function parseResponseBody($body) |
| 52 | 52 | { |
| 53 | - if(empty($body)){ |
|
| 53 | + if (empty($body)) { |
|
| 54 | 54 | throw new \Exception("No response recieved"); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if( \is_string($body)){ |
|
| 57 | + if (\is_string($body)) { |
|
| 58 | 58 | $this->status = 'success'; |
| 59 | 59 | $this->statusCode = '200'; |
| 60 | 60 | $this->shorturl = $url; |
| 61 | 61 | return; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - foreach( (array) $body as $key => $value){ |
|
| 64 | + foreach ((array) $body as $key => $value) { |
|
| 65 | 65 | $this->{$key} = $value; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -158,14 +158,14 @@ discard block |
||
| 158 | 158 | */ |
| 159 | 159 | public function stats(string $filter = null, int $limit = null, string $format = null) |
| 160 | 160 | { |
| 161 | - $filter = empty($filter) || ! in_array($filter, $this->filters) ? $this->filter : $filter; |
|
| 161 | + $filter = empty($filter) || !in_array($filter, $this->filters) ? $this->filter : $filter; |
|
| 162 | 162 | |
| 163 | 163 | $params = [ |
| 164 | 164 | 'action' => 'stats', |
| 165 | 165 | 'filter' => $filter, |
| 166 | 166 | 'format' => $this->setFormat($format), |
| 167 | 167 | ]; |
| 168 | - if (! empty($limit)) { |
|
| 168 | + if (!empty($limit)) { |
|
| 169 | 169 | $params = array_merge($params, ['limit' => $limit]); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $form_params = array_merge($request, $this->authParam); |
| 205 | 205 | |
| 206 | 206 | $result = $this->client->request('POST', 'yourls-api.php', ['form_params' => $form_params]); |
| 207 | - if(! $result || '200' != $result->getStatusCode()) { |
|
| 207 | + if (!$result || '200' != $result->getStatusCode()) { |
|
| 208 | 208 | throw new \Exception('Failed to process request'); |
| 209 | 209 | } |
| 210 | 210 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * |
| 233 | 233 | * @return string |
| 234 | 234 | */ |
| 235 | - protected function setFormat(string $format = NULL){ |
|
| 236 | - return empty($format) || !in_array($format, $this->formats) ? $this->format: $format; |
|
| 235 | + protected function setFormat(string $format = NULL) { |
|
| 236 | + return empty($format) || !in_array($format, $this->formats) ? $this->format : $format; |
|
| 237 | 237 | } |
| 238 | 238 | } |