@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | * Internal method for handling all requests |
| 113 | 113 | * |
| 114 | 114 | * @internal |
| 115 | - * @param $method |
|
| 116 | - * @param $endpoint |
|
| 115 | + * @param string $method |
|
| 116 | + * @param string $endpoint |
|
| 117 | 117 | * @param array|null $data |
| 118 | 118 | * @param array|null $query |
| 119 | 119 | * @return mixed|null |
@@ -200,6 +200,7 @@ discard block |
||
| 200 | 200 | * |
| 201 | 201 | * @internal |
| 202 | 202 | * @param null $id |
| 203 | + * @param string $endPoint |
|
| 203 | 204 | * @return string |
| 204 | 205 | */ |
| 205 | 206 | public function createEndpoint($endPoint, $id = null) |
@@ -126,14 +126,14 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | $options = ['json' => $data]; |
| 128 | 128 | |
| 129 | - if(isset($query)) { |
|
| 129 | + if (isset($query)) { |
|
| 130 | 130 | $options['query'] = $query; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $url = $this->baseUrl . $endpoint; |
| 134 | 134 | |
| 135 | 135 | try { |
| 136 | - switch($method) { |
|
| 136 | + switch ($method) { |
|
| 137 | 137 | case 'GET': |
| 138 | 138 | return $this->client->get($url, $options)->json(); |
| 139 | 139 | break; |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | private function handleException(RequestException $e) |
| 164 | 164 | { |
| 165 | - switch($e->getResponse()->getStatusCode()) { |
|
| 165 | + switch ($e->getResponse()->getStatusCode()) { |
|
| 166 | 166 | case 400: |
| 167 | 167 | return new ValidationException($e); |
| 168 | 168 | break; |
@@ -204,6 +204,6 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | public function createEndpoint($endPoint, $id = null) |
| 206 | 206 | { |
| 207 | - return $id == null ? $endPoint : $endPoint.'/'.$id; |
|
| 207 | + return $id == null ? $endPoint : $endPoint . '/' . $id; |
|
| 208 | 208 | } |
| 209 | 209 | } |
@@ -149,8 +149,7 @@ |
||
| 149 | 149 | default: |
| 150 | 150 | return null; |
| 151 | 151 | } |
| 152 | - } |
|
| 153 | - catch (RequestException $e) { |
|
| 152 | + } catch (RequestException $e) { |
|
| 154 | 153 | throw $this->handleException($e); |
| 155 | 154 | } |
| 156 | 155 | } |