@@ -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 |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | try { |
137 | - if(array_key_exists($key, $this->attributes) && is_array($this->attributes[$key]) && array_key_exists('__deferred', $this->attributes[$key])) { |
|
137 | + if (array_key_exists($key, $this->attributes) && is_array($this->attributes[$key]) && array_key_exists('__deferred', $this->attributes[$key])) { |
|
138 | 138 | $class = preg_replace('/(.+?)s?$/', __NAMESPACE__ . '\\\$1', $key); // Filter plural 's' and add namespace |
139 | 139 | $deferred = new $class($this->connection()); |
140 | 140 | $uri = $this->attributes[$key]['__deferred']['uri']; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | return $this->deferred[$key]; |
159 | 159 | } |
160 | 160 | |
161 | - if (isset( $this->attributes[$key] )) { |
|
161 | + if (isset($this->attributes[$key])) { |
|
162 | 162 | return $this->attributes[$key]; |
163 | 163 | } |
164 | 164 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | return false; |
197 | 197 | } |
198 | 198 | |
199 | - return ! empty( $this->attributes[$this->primaryKey] ); |
|
199 | + return ! empty($this->attributes[$this->primaryKey]); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | { |
212 | 212 | $attributes = $this->attributes; |
213 | 213 | if ($withDeferred) { |
214 | - foreach($this->deferred as $attribute => $collection) { |
|
214 | + foreach ($this->deferred as $attribute => $collection) { |
|
215 | 215 | if (empty($collection)) { |
216 | 216 | continue; // Leave orriginal array with __deferred key |
217 | 217 | } |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @return boolean |
252 | 252 | */ |
253 | - public function userHasRights($action='GET') |
|
253 | + public function userHasRights($action = 'GET') |
|
254 | 254 | { |
255 | - $action = preg_match('/^GET|POST|PUT|DELETE$/i', $action) ? strtoupper($action) : 'GET'; |
|
255 | + $action = preg_match('/^GET|POST|PUT|DELETE$/i', $action) ? strtoupper($action) : 'GET'; |
|
256 | 256 | $result = $this->connection()->get('users/UserHasRights', [ |
257 | 257 | 'endpoint' => "'{$this->url}'", |
258 | 258 | 'action' => "'{$action}'" |