@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | public function use(string $resource): self |
| 96 | 96 | { |
| 97 | - if (! $this->resources->pluck('name')->contains($resource)) { |
|
| 97 | + if (!$this->resources->pluck('name')->contains($resource)) { |
|
| 98 | 98 | throw new ResourceNotRegistered("No resource registered for: {$resource}"); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | return $this; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - public function getResource():? array |
|
| 106 | + public function getResource(): ? array |
|
| 107 | 107 | { |
| 108 | 108 | return $this->resource; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | public function get(string $method = 'GET') |
| 112 | 112 | { |
| 113 | - if (! $this->checkAbility('get')) { |
|
| 113 | + if (!$this->checkAbility('get')) { |
|
| 114 | 114 | throw new MethodNotAllowed("Method get is not available on this resource"); |
| 115 | 115 | } |
| 116 | 116 | |
@@ -119,16 +119,16 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | public function find($identifier, string $method = 'GET') |
| 121 | 121 | { |
| 122 | - if (! $this->checkAbility('find')) { |
|
| 122 | + if (!$this->checkAbility('find')) { |
|
| 123 | 123 | throw new MethodNotAllowed("Method find is not available on this resource"); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - return $this->call($method, $this->resource['endpoint'] . '/' . (string) $identifier); |
|
| 126 | + return $this->call($method, $this->resource['endpoint'].'/'.(string) $identifier); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | public function create(array $data) |
| 130 | 130 | { |
| 131 | - if (! $this->checkAbility('create')) { |
|
| 131 | + if (!$this->checkAbility('create')) { |
|
| 132 | 132 | throw new MethodNotAllowed("Method create is not available on this resource"); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -137,20 +137,20 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | public function update($identifier, array $data, string $method = 'PUT') |
| 139 | 139 | { |
| 140 | - if (! $this->checkAbility('update')) { |
|
| 140 | + if (!$this->checkAbility('update')) { |
|
| 141 | 141 | throw new MethodNotAllowed("Method update is not available on this resource"); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - return $this->call($method, $this->resource['endpoint'] . '/' . (string) $identifier, $data); |
|
| 144 | + return $this->call($method, $this->resource['endpoint'].'/'.(string) $identifier, $data); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | public function delete($identifier, string $method = 'DELETE') |
| 148 | 148 | { |
| 149 | - if (! $this->checkAbility('delete')) { |
|
| 149 | + if (!$this->checkAbility('delete')) { |
|
| 150 | 150 | throw new MethodNotAllowed("Method delete is not available on this resource"); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - return $this->call($method, $this->resource['endpoint'] . '/' . (string) $identifier); |
|
| 153 | + return $this->call($method, $this->resource['endpoint'].'/'.(string) $identifier); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | protected function checkAbility(string $method) |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $uri = ''; |
| 181 | 181 | |
| 182 | 182 | if ($this->getScheme() !== '') { |
| 183 | - $uri .= $this->getScheme() . '://'; |
|
| 183 | + $uri .= $this->getScheme().'://'; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | if ($this->getHost() !== '') { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | $uri .= rtrim($this->getPath(), '/'); |
| 191 | 191 | |
| 192 | - $uri .= '/' . rtrim($endpoint, '/'); |
|
| 192 | + $uri .= '/'.rtrim($endpoint, '/'); |
|
| 193 | 193 | |
| 194 | 194 | return $uri; |
| 195 | 195 | } |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | { |
| 199 | 199 | $scheme = strtolower($scheme); |
| 200 | 200 | |
| 201 | - if (! in_array($scheme, $this->allowedSchemes)) { |
|
| 201 | + if (!in_array($scheme, $this->allowedSchemes)) { |
|
| 202 | 202 | throw new UnsupportedScheme( |
| 203 | 203 | "The scheme `{$scheme}` isn't valid. It should be either `http` or `https`." |
| 204 | 204 | ); |