Completed
Push — develop ( fcedfd...9763c2 )
by Jimmy
13s queued 11s
created
src/Support/ModelResolver.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
         $pattern = preg_replace('|(/)\\d+(/?)|u', '$1{id}$2', $pattern);
46 46
 
47 47
         // Make regex
48
-        $pattern = '|^/' . $pattern . '$|ui';
48
+        $pattern = '|^/'.$pattern.'$|ui';
49 49
 
50 50
         // Search the map for the uri that matches
51 51
         return ($uri = $this->maps[$version]->search(
52
-            function ($model, $uri) use ($pattern) {
52
+            function($model, $uri) use ($pattern) {
53 53
                 return preg_match($pattern, $uri);
54 54
             }
55 55
         )) ? $this->maps[$version][$uri] : null;
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         if (!array_key_exists($version, $this->maps)) {
66 66
             $this->maps[$version] = collect(
67 67
                 json_decode(
68
-                    @file_get_contents(__DIR__ . '/../Models/v' . str_replace('.', '_', $version) . '/map.json'),
68
+                    @file_get_contents(__DIR__.'/../Models/v'.str_replace('.', '_', $version).'/map.json'),
69 69
                     true
70 70
                 )
71 71
             );
Please login to merge, or discard this patch.
src/Api/Token.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     protected function endpoint()
60 60
     {
61
-        return 'system/members/' . $this->member_id . '/tokens';
61
+        return 'system/members/'.$this->member_id.'/tokens';
62 62
     }
63 63
 
64 64
     /**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      */
119 119
     public function getUsername()
120 120
     {
121
-        return $this->company_id . '+' . $this->username;
121
+        return $this->company_id.'+'.$this->username;
122 122
     }
123 123
 
124 124
     /**
Please login to merge, or discard this patch.
src/Laravel/ServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     {
79 79
         $this->app->singleton(
80 80
             Client::class,
81
-            function (Application $app) {
81
+            function(Application $app) {
82 82
                 return (new Client(
83 83
                     $app->make(Token::class),
84 84
                     $app->make(Guzzle::class),
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $this->app->singleton(
117 117
             Token::class,
118
-            function (Application $app) {
118
+            function(Application $app) {
119 119
                 return (new Token())->setCompanyId($app->config->get('services.connectwise.company_id'))
120 120
                                     ->setMemberId($this->determineMemberId());
121 121
             }
Please login to merge, or discard this patch.
generator/generator.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 use Illuminate\Support\Collection;
4 4
 
5
-require __DIR__ . '/../vendor/autoload.php';
5
+require __DIR__.'/../vendor/autoload.php';
6 6
 
7 7
 class Swagger
8 8
 {
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
 
68 68
         // Make array of types keyed by property
69 69
         $property_type = collect($attributes['properties'])
70
-            ->map(function ($attributes) {
70
+            ->map(function($attributes) {
71 71
                 return $this->parseType($attributes);
72 72
             });
73 73
 
74
-        $casts = $property_type->map(function ($type, $property) {
74
+        $casts = $property_type->map(function($type, $property) {
75 75
             $primitives = [
76 76
                 'array',
77 77
                 'boolean',
@@ -81,13 +81,13 @@  discard block
 block discarded – undo
81 81
                 'string',
82 82
             ];
83 83
 
84
-            return "        '${property}' => " . ((in_array($type, $primitives)) ? "'${type}'" : "${type}::class");
84
+            return "        '${property}' => ".((in_array($type, $primitives)) ? "'${type}'" : "${type}::class");
85 85
         })
86 86
                                ->values()
87 87
                                ->sort()
88 88
                                ->implode(",\n");
89 89
 
90
-        $properties = $property_type->map(function ($type, $property) {
90
+        $properties = $property_type->map(function($type, $property) {
91 91
             return " * @property ${type} $${property}";
92 92
         })
93 93
                                     ->values()
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $model = preg_replace('|{{ Namespace }}|u', $this->getNamespace(), $template);
98 98
         $model = preg_replace('|{{ Version }}|u', $this->version, $model);
99 99
         $model = preg_replace('|{{ Class }}|u', $class, $model);
100
-        $model = preg_replace('|{{ Description }}|u', $attributes['description'] ?? 'Model for ' . $class, $model);
100
+        $model = preg_replace('|{{ Description }}|u', $attributes['description'] ?? 'Model for '.$class, $model);
101 101
         $model = preg_replace('|{{ Casts }}|u', $casts, $model);
102 102
         $model = preg_replace('|{{ Properties }}|u', $properties, $model);
103 103
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 
211 211
         $this->swaggers = collect([]);
212 212
 
213
-        foreach (glob(__DIR__ . "/swagger/" . $this->version . "/*.json") as $swaggerfile) {
213
+        foreach (glob(__DIR__."/swagger/".$this->version."/*.json") as $swaggerfile) {
214 214
             $this->swaggers->push(new Swagger($swaggerfile, $this->version));
215 215
         }
216 216
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     public function process()
221 221
     {
222 222
         $this->swaggers->each(
223
-            function (Swagger $swagger) {
223
+            function(Swagger $swagger) {
224 224
                 $swagger->parseDefinitions();
225 225
 
226 226
                 $swagger->parsePaths();
@@ -234,30 +234,30 @@  discard block
 block discarded – undo
234 234
 /** @var Loader $loader */
235 235
 $loader = new Loader();
236 236
 
237
-foreach (glob(__DIR__ . "/swagger/*") as $version) {
237
+foreach (glob(__DIR__."/swagger/*") as $version) {
238 238
     $version = basename($version);
239 239
 
240 240
     echo "Working on version ${version}\n";
241 241
 
242 242
     $loader->loadVersion($version)
243
-           ->process()->swaggers->each(function (Swagger $swagger) use ($version) {
244
-                $directory = __DIR__ . '/Generated/' . $version;
243
+           ->process()->swaggers->each(function(Swagger $swagger) use ($version) {
244
+                $directory = __DIR__.'/Generated/'.$version;
245 245
 
246
-                echo "Writing " . $swagger->getTitle() . "\n";
246
+                echo "Writing ".$swagger->getTitle()."\n";
247 247
 
248
-                mkdir($directory . '/' . $swagger->getTitle(), 0755, true);
248
+                mkdir($directory.'/'.$swagger->getTitle(), 0755, true);
249 249
 
250
-                $swagger->models->each(function ($contents, $model) use ($directory, $swagger) {
251
-                    file_put_contents($directory . '/' . $swagger->getTitle() . '/' . $model . '.php', $contents);
250
+                $swagger->models->each(function($contents, $model) use ($directory, $swagger) {
251
+                    file_put_contents($directory.'/'.$swagger->getTitle().'/'.$model.'.php', $contents);
252 252
                 });
253 253
 
254 254
                 echo "Appending map\n";
255 255
 
256
-                $map = collect(json_decode(@ file_get_contents($directory . '/map.json'), true))
256
+                $map = collect(json_decode(@ file_get_contents($directory.'/map.json'), true))
257 257
                     ->merge($swagger->map)
258 258
                     ->sort();
259 259
 
260
-                file_put_contents($directory . '/map.json', $map->toJson());
260
+                file_put_contents($directory.'/map.json', $map->toJson());
261 261
            });
262 262
 }
263 263
 
Please login to merge, or discard this patch.
src/Api/Client.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             $this->token->refresh($this);
191 191
         }
192 192
 
193
-        return 'Basic ' . base64_encode($this->token->getUsername() . ':' . $this->token->getPassword());
193
+        return 'Basic '.base64_encode($this->token->getUsername().':'.$this->token->getPassword());
194 194
     }
195 195
 
196 196
     /**
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
         // For getAll calls, make sure to add pageSize & page to request
229 229
         if ($this->page) {
230
-            $uri .= (preg_match('/\\?/u', $uri) ? '&' : '?') . 'pageSize=' . $this->page_size . '&page=' . $this->page;
230
+            $uri .= (preg_match('/\\?/u', $uri) ? '&' : '?').'pageSize='.$this->page_size.'&page='.$this->page;
231 231
         }
232 232
 
233 233
         if (strlen($uri) > 2000) {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
         return array_merge(
288 288
             [
289 289
                 'x-cw-usertype' => 'member',
290
-                'Accept'        => 'application/vnd.connectwise.com+json; version=' . $this->getVersion(),
290
+                'Accept'        => 'application/vnd.connectwise.com+json; version='.$this->getVersion(),
291 291
             ],
292 292
             $authorization_headers,
293 293
             $this->headers
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
      */
324 324
     public function getUrl($path = null)
325 325
     {
326
-        return $this->url . '/v4_6_release/apis/3.0/' . ltrim($path, '/');
326
+        return $this->url.'/v4_6_release/apis/3.0/'.ltrim($path, '/');
327 327
     }
328 328
 
329 329
     /**
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
      */
377 377
     protected function isLastPage(ResponseInterface $response)
378 378
     {
379
-        return !(bool)preg_match('/rel="last"$/u', $response->getHeader('Link')[0] ?? null);
379
+        return !(bool) preg_match('/rel="last"$/u', $response->getHeader('Link')[0] ?? null);
380 380
     }
381 381
 
382 382
     /**
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
      */
405 405
     protected function processResponse($resource, ResponseInterface $response)
406 406
     {
407
-        $response = (array)json_decode($response->getBody(), true);
407
+        $response = (array) json_decode($response->getBody(), true);
408 408
 
409 409
         // Nothing to map response, so just return it as is
410 410
         if (!$model = $this->resolver->find($resource, $this->getVersion())) {
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
         // Have a collection of records, so cast them all as a collection
420 420
         return new Collection(
421 421
             array_map(
422
-                function ($item) use ($model) {
422
+                function($item) use ($model) {
423 423
                     $item = new $model($item, $this);
424 424
 
425 425
                     return $item;
Please login to merge, or discard this patch.
src/Support/Model.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             }
94 94
         }
95 95
 
96
-        trigger_error('Call to undefined method ' . __CLASS__ . '::' . $method . '()', E_USER_ERROR);
96
+        trigger_error('Call to undefined method '.__CLASS__.'::'.$method.'()', E_USER_ERROR);
97 97
     }
98 98
 
99 99
     /**
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
         }
184 184
 
185 185
         if (class_exists($cast)) {
186
-            return new $cast((array)$value);
186
+            return new $cast((array) $value);
187 187
         }
188 188
 
189 189
         if (strcasecmp('json', $cast) == 0) {
190
-            return json_encode((array)$value);
190
+            return json_encode((array) $value);
191 191
         }
192 192
 
193 193
         if (strcasecmp('collection', $cast) == 0) {
194
-            return new Collection((array)$value);
194
+            return new Collection((array) $value);
195 195
         }
196 196
 
197 197
         if (in_array($cast, ['bool', 'boolean'])) {
@@ -306,8 +306,8 @@  discard block
 block discarded – undo
306 306
 
307 307
         // Allow for making related calls for "extra" properties in the "_info" property.
308 308
         // Cache the results so only 1 call is made
309
-        if (!isset($this->{$attribute}) && isset($this->_info->{$attribute . '_href'})) {
310
-            $this->setAttribute($attribute, $this->client->getAll($this->_info->{$attribute . '_href'}));
309
+        if (!isset($this->{$attribute}) && isset($this->_info->{$attribute.'_href'})) {
310
+            $this->setAttribute($attribute, $this->client->getAll($this->_info->{$attribute.'_href'}));
311 311
         }
312 312
 
313 313
         // Pull the value from the attributes
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
         };
317 317
 
318 318
         // Attribute does not exist on the model
319
-        trigger_error('Undefined property:' . __CLASS__ . '::$' . $attribute);
319
+        trigger_error('Undefined property:'.__CLASS__.'::$'.$attribute);
320 320
     }
321 321
 
322 322
     /**
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
      */
355 355
     protected function getterMethodName($attribute)
356 356
     {
357
-        return 'get' . Str::studly($attribute) . 'Attribute';
357
+        return 'get'.Str::studly($attribute).'Attribute';
358 358
     }
359 359
 
360 360
     /**
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
      */
460 460
     protected function setterMethodName($attribute)
461 461
     {
462
-        return 'set' . Str::studly($attribute) . 'Attribute';
462
+        return 'set'.Str::studly($attribute).'Attribute';
463 463
     }
464 464
 
465 465
     /**
Please login to merge, or discard this patch.