Completed
Pull Request — develop (#34)
by Jimmy
03:23
created
src/Support/Model.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
             }
97 97
         }
98 98
 
99
-        trigger_error('Call to undefined method ' . __CLASS__ . '::' . $method . '()', E_USER_ERROR);
99
+        trigger_error('Call to undefined method '.__CLASS__.'::'.$method.'()', E_USER_ERROR);
100 100
     }
101 101
 
102 102
     /**
@@ -186,15 +186,15 @@  discard block
 block discarded – undo
186 186
         }
187 187
 
188 188
         if (class_exists($cast)) {
189
-            return new $cast((array)$value);
189
+            return new $cast((array) $value);
190 190
         }
191 191
 
192 192
         if (strcasecmp('json', $cast) == 0) {
193
-            return json_encode((array)$value);
193
+            return json_encode((array) $value);
194 194
         }
195 195
 
196 196
         if (strcasecmp('collection', $cast) == 0) {
197
-            return new Collection((array)$value);
197
+            return new Collection((array) $value);
198 198
         }
199 199
 
200 200
         if (in_array($cast, ['bool', 'boolean'])) {
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
 
310 310
         // Allow for making related calls for "extra" properties in the "_info" property.
311 311
         // Cache the results so only 1 call is made
312
-        if (!isset($this->{$attribute}) && isset($this->_info->{$attribute . '_href'})) {
312
+        if (!isset($this->{$attribute}) && isset($this->_info->{$attribute.'_href'})) {
313 313
             $this->setAttribute(
314 314
                 $attribute,
315 315
                 $this->client->getAll(
316
-                    Str::replaceFirst($this->client->getUrl(), '', $this->_info->{$attribute . '_href'})
316
+                    Str::replaceFirst($this->client->getUrl(), '', $this->_info->{$attribute.'_href'})
317 317
                 )
318 318
             );
319 319
         }
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
         };
325 325
 
326 326
         // Attribute does not exist on the model
327
-        trigger_error('Undefined property:' . __CLASS__ . '::$' . $attribute);
327
+        trigger_error('Undefined property:'.__CLASS__.'::$'.$attribute);
328 328
     }
329 329
 
330 330
     /**
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
      */
363 363
     protected function getterMethodName($attribute)
364 364
     {
365
-        return 'get' . Str::studly($attribute) . 'Attribute';
365
+        return 'get'.Str::studly($attribute).'Attribute';
366 366
     }
367 367
 
368 368
     /**
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
      */
468 468
     protected function setterMethodName($attribute)
469 469
     {
470
-        return 'set' . Str::studly($attribute) . 'Attribute';
470
+        return 'set'.Str::studly($attribute).'Attribute';
471 471
     }
472 472
 
473 473
     /**
Please login to merge, or discard this patch.
src/Api/Client.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
             $this->token->refresh($this);
187 187
         }
188 188
 
189
-        return 'Basic ' . base64_encode($this->token->getUsername() . ':' . $this->token->getPassword());
189
+        return 'Basic '.base64_encode($this->token->getUsername().':'.$this->token->getPassword());
190 190
     }
191 191
 
192 192
     /**
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
     public function buildUri($resource)
221 221
     {
222 222
         // TODO: Check to see if resource already starts with Url to not have to trim it
223
-        $uri = $this->getUrl() . ltrim($resource, '/');
223
+        $uri = $this->getUrl().ltrim($resource, '/');
224 224
 
225 225
         // For getAll calls, make sure to add pageSize & page to request
226 226
         if ($this->page) {
227
-            $uri .= (preg_match('/\\?/u', $uri) ? '&' : '?') . 'pageSize=' . $this->page_size . '&page=' . $this->page;
227
+            $uri .= (preg_match('/\\?/u', $uri) ? '&' : '?').'pageSize='.$this->page_size.'&page='.$this->page;
228 228
         }
229 229
 
230 230
         if (strlen($uri) > 2000) {
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         return array_merge(
285 285
             [
286 286
                 'x-cw-usertype' => 'member',
287
-                'Accept'        => 'application/vnd.connectwise.com+json; version=' . $this->getVersion(),
287
+                'Accept'        => 'application/vnd.connectwise.com+json; version='.$this->getVersion(),
288 288
             ],
289 289
             $authorization_headers,
290 290
             $this->headers
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      */
319 319
     public function getUrl()
320 320
     {
321
-        return $this->url . '/v4_6_release/apis/3.0/';
321
+        return $this->url.'/v4_6_release/apis/3.0/';
322 322
     }
323 323
 
324 324
     /**
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
      */
372 372
     protected function isLastPage(Response $response)
373 373
     {
374
-        return !(bool)preg_match('/rel="last"$/u', $response->getHeader('Link')[0] ?? null);
374
+        return !(bool) preg_match('/rel="last"$/u', $response->getHeader('Link')[0] ?? null);
375 375
     }
376 376
 
377 377
     /**
@@ -399,12 +399,12 @@  discard block
 block discarded – undo
399 399
      */
400 400
     protected function processResponse($resource, Response $response)
401 401
     {
402
-        $response = (array)json_decode($response->getBody(), true);
402
+        $response = (array) json_decode($response->getBody(), true);
403 403
 
404 404
         if ($model = $this->resolver->find($resource, $this->getVersion())) {
405 405
             if ($this->isCollection($response)) {
406 406
                 $response = array_map(
407
-                    function ($item) use ($model) {
407
+                    function($item) use ($model) {
408 408
                         $item = new $model($item, $this);
409 409
 
410 410
                         return $item;
Please login to merge, or discard this patch.