@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * @var array The model's attributes |
20 | 20 | */ |
21 | - protected $attributes = [ ]; |
|
21 | + protected $attributes = []; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * @deferred array The model's collection values |
25 | 25 | */ |
26 | - protected $deferred = [ ]; |
|
26 | + protected $deferred = []; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * @var array The model's fillable attributes |
30 | 30 | */ |
31 | - protected $fillable = [ ]; |
|
31 | + protected $fillable = []; |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * @var string The URL endpoint of this model |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | try { |
137 | 137 | $isArray = isset($this->attributes[$key]) && is_array($this->attributes[$key]); |
138 | - if($isArray && array_key_exists('__deferred', $this->attributes[$key])) { |
|
138 | + if ($isArray && array_key_exists('__deferred', $this->attributes[$key])) { |
|
139 | 139 | $class = preg_replace('/(.+?)s?$/', __NAMESPACE__ . '\\\$1', $key); // Filter plural 's' and add namespace |
140 | 140 | $deferred = new $class($this->connection()); |
141 | 141 | $uri = $this->attributes[$key]['__deferred']['uri']; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | return $this->deferred[$key]; |
160 | 160 | } |
161 | 161 | |
162 | - if (isset( $this->attributes[$key] )) { |
|
162 | + if (isset($this->attributes[$key])) { |
|
163 | 163 | return $this->attributes[$key]; |
164 | 164 | } |
165 | 165 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | return false; |
198 | 198 | } |
199 | 199 | |
200 | - return ! empty( $this->attributes[$this->primaryKey] ); |
|
200 | + return ! empty($this->attributes[$this->primaryKey]); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | { |
213 | 213 | $attributes = $this->attributes; |
214 | 214 | if ($withDeferred) { |
215 | - foreach($this->deferred as $attribute => $collection) { |
|
215 | + foreach ($this->deferred as $attribute => $collection) { |
|
216 | 216 | if (empty($collection)) { |
217 | 217 | continue; // Leave orriginal array with __deferred key |
218 | 218 | } |
@@ -251,9 +251,9 @@ discard block |
||
251 | 251 | * |
252 | 252 | * @return boolean |
253 | 253 | */ |
254 | - public function userHasRights($action='GET') |
|
254 | + public function userHasRights($action = 'GET') |
|
255 | 255 | { |
256 | - $action = preg_match('/^GET|POST|PUT|DELETE$/i', $action) ? strtoupper($action) : 'GET'; |
|
256 | + $action = preg_match('/^GET|POST|PUT|DELETE$/i', $action) ? strtoupper($action) : 'GET'; |
|
257 | 257 | $result = $this->connection()->get('users/UserHasRights', [ |
258 | 258 | 'endpoint' => "'{$this->url}'", |
259 | 259 | 'action' => "'{$action}'" |