Passed
Pull Request — develop (#31)
by Jimmy
02:37
created
src/Api/Token.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@
 block discarded – undo
130 130
     {
131 131
         return !is_null($this->expiration) &&
132 132
                Carbon::now()
133
-                     ->gte($this->expiration);
133
+                        ->gte($this->expiration);
134 134
     }
135 135
 
136 136
     /**
Please login to merge, or discard this 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/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.
generator/generator.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * "Generated" that you can move to src/Models/
12 12
  */
13 13
 
14
-require __DIR__ . '/../vendor/autoload.php';
14
+require __DIR__.'/../vendor/autoload.php';
15 15
 
16 16
 use Illuminate\Support\Str;
17 17
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 
70 70
 function mapResourceToClass($uri, $namespace, $class)
71 71
 {
72
-    echo "'${uri}' => '" . $namespace . "\\" . $class . "',\n";
72
+    echo "'${uri}' => '".$namespace."\\".$class."',\n";
73 73
 }
74 74
 
75 75
 function parseResponse($response, $uri)
@@ -97,18 +97,18 @@  discard block
 block discarded – undo
97 97
 function processPaths()
98 98
 {
99 99
     $namespace = Str::studly($GLOBALS['api']);
100
-    $path = __DIR__ . '/Generated/' . $GLOBALS['version'] . '/';
100
+    $path = __DIR__.'/Generated/'.$GLOBALS['version'].'/';
101 101
 
102
-    mkdir($path . $namespace, 0755, true);
102
+    mkdir($path.$namespace, 0755, true);
103 103
 
104 104
     foreach ($GLOBALS['swagger']['paths'] as $uri => $actions) {
105 105
         if (array_key_exists('get', $actions)) {
106 106
             $docs = $actions['get'];
107 107
             $class = Str::singular($docs['tags'][0]);
108
-            $file = $path . '/' . $namespace . '/' . $class . '.php';
108
+            $file = $path.'/'.$namespace.'/'.$class.'.php';
109 109
 
110 110
             if (!file_exists($file)) {
111
-                $GLOBALS['map'][$uri] = $GLOBALS['version'] . '\\' . $namespace . '\\' . $class;
111
+                $GLOBALS['map'][$uri] = $GLOBALS['version'].'\\'.$namespace.'\\'.$class;
112 112
 
113 113
                 $attributes = parseResponse(getResponse($docs['responses']), $uri);
114 114
 
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
     $properties = null;
160 160
 
161 161
     foreach ($attributes as $attribute => $type) {
162
-        $casts .= "\n        '" . $attribute . "' => '" . $type . "',";
163
-        $properties .= "\n * @property " . $type . ' $' . $attribute;
162
+        $casts .= "\n        '".$attribute."' => '".$type."',";
163
+        $properties .= "\n * @property ".$type.' $'.$attribute;
164 164
     }
165 165
 
166 166
     $file = preg_replace('|{{ Namespace }}|u', $namespace, $template);
@@ -172,18 +172,18 @@  discard block
 block discarded – undo
172 172
     file_put_contents($file_path, $file);
173 173
 }
174 174
 
175
-foreach (glob(__DIR__ . "/swagger/*") as $version) {
175
+foreach (glob(__DIR__."/swagger/*") as $version) {
176 176
     $GLOBALS['version'] = basename($version);
177 177
     $GLOBALS['map'] = null;
178 178
 
179
-    foreach (glob(__DIR__ . "/swagger/" . $GLOBALS['version'] . "/*.json") as $swaggerfile) {
179
+    foreach (glob(__DIR__."/swagger/".$GLOBALS['version']."/*.json") as $swaggerfile) {
180 180
         $GLOBALS['api'] = explode('.', basename($swaggerfile))[0];
181 181
         $GLOBALS['swagger'] = readSwagger($swaggerfile);
182 182
 
183 183
         processPaths();
184 184
     }
185 185
 
186
-    file_put_contents(__DIR__ . '/Generated/' . $GLOBALS['version'] . '/map.json', json_encode($GLOBALS['map']));
186
+    file_put_contents(__DIR__.'/Generated/'.$GLOBALS['version'].'/map.json', json_encode($GLOBALS['map']));
187 187
 }
188 188
 
189 189
 
Please login to merge, or discard this patch.
src/Laravel/ServiceProvider.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -84,10 +84,10 @@
 block discarded – undo
84 84
                     $app->make(Guzzle::class),
85 85
                     $app->make(ModelResolver::class)
86 86
                 ))->setClientId($app->config->get('services.connectwise.client_id'))
87
-                  ->setIntegrator($app->config->get('services.connectwise.integrator'))
88
-                  ->setPassword($app->config->get('services.connectwise.password'))
89
-                  ->setUrl($app->config->get('services.connectwise.url'))
90
-                  ->setVersion($app->config->get('services.connectwise.version'));
87
+                    ->setIntegrator($app->config->get('services.connectwise.integrator'))
88
+                    ->setPassword($app->config->get('services.connectwise.password'))
89
+                    ->setUrl($app->config->get('services.connectwise.url'))
90
+                    ->setVersion($app->config->get('services.connectwise.version'));
91 91
             }
92 92
         );
93 93
     }
Please login to merge, or discard this 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.
src/Support/Model.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             }
93 93
         }
94 94
 
95
-        trigger_error('Call to undefined method ' . __CLASS__ . '::' . $method . '()', E_USER_ERROR);
95
+        trigger_error('Call to undefined method '.__CLASS__.'::'.$method.'()', E_USER_ERROR);
96 96
     }
97 97
 
98 98
     /**
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
         }
164 164
 
165 165
         if (strcasecmp('json', $cast) == 0) {
166
-            return json_encode((array)$value);
166
+            return json_encode((array) $value);
167 167
         }
168 168
 
169 169
         if (strcasecmp('collection', $cast) == 0) {
170
-            return new Collection((array)$value);
170
+            return new Collection((array) $value);
171 171
         }
172 172
 
173 173
         if (in_array($cast, ['bool', 'boolean'])) {
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             return $this->attributes[$attribute];
273 273
         };
274 274
 
275
-        trigger_error('Undefined property:'. __CLASS__ . '::$' . $attribute);
275
+        trigger_error('Undefined property:'.__CLASS__.'::$'.$attribute);
276 276
     }
277 277
 
278 278
     /**
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
      */
301 301
     protected function getterMethodName($attribute)
302 302
     {
303
-        return 'get' . Str::studly($attribute) . 'Attribute';
303
+        return 'get'.Str::studly($attribute).'Attribute';
304 304
     }
305 305
 
306 306
     /**
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
      */
396 396
     protected function setterMethodName($attribute)
397 397
     {
398
-        return 'set' . Str::studly($attribute) . 'Attribute';
398
+        return 'set'.Str::studly($attribute).'Attribute';
399 399
     }
400 400
 
401 401
     /**
Please login to merge, or discard this patch.
src/Api/Client.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             $this->token->refresh($this);
170 170
         }
171 171
 
172
-        return 'Basic ' . base64_encode($this->token->getUsername() . ':' . $this->token->getPassword());
172
+        return 'Basic '.base64_encode($this->token->getUsername().':'.$this->token->getPassword());
173 173
     }
174 174
 
175 175
     /**
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
      */
203 203
     public function buildUri($resource)
204 204
     {
205
-        $uri = $this->getUrl() . ltrim($resource, '/');
205
+        $uri = $this->getUrl().ltrim($resource, '/');
206 206
 
207 207
         if (strlen($uri) > 2000) {
208 208
             throw new MalformedRequest(
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         return array_merge(
262 262
             [
263 263
                 'x-cw-usertype' => 'member',
264
-                'Accept'        => 'application/vnd.connectwise.com+json; version=' . $this->getVersion(),
264
+                'Accept'        => 'application/vnd.connectwise.com+json; version='.$this->getVersion(),
265 265
             ],
266 266
             $authorization_headers,
267 267
             $this->headers
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
      */
296 296
     public function getUrl()
297 297
     {
298
-        return $this->url . '/v4_6_release/apis/3.0/';
298
+        return $this->url.'/v4_6_release/apis/3.0/';
299 299
     }
300 300
 
301 301
     /**
@@ -334,12 +334,12 @@  discard block
 block discarded – undo
334 334
      */
335 335
     protected function processResponse($resource, Response $response)
336 336
     {
337
-        $response = (array)json_decode($response->getBody(), true);
337
+        $response = (array) json_decode($response->getBody(), true);
338 338
 
339 339
         if ($model = $this->resolver->find($resource, $this->getVersion())) {
340 340
             if ($this->isCollection($response)) {
341 341
                 $response = array_map(
342
-                    function ($item) use ($model) {
342
+                    function($item) use ($model) {
343 343
                         $item = new $model($item, $this);
344 344
 
345 345
                         return $item;
Please login to merge, or discard this patch.
generator/generator2.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
     echo "Working on version ${version}\n";
218 218
 
219 219
     $loader->loadVersion($version)
220
-           ->process()->swaggers->each(function (Swagger $swagger) use ($version) {
220
+            ->process()->swaggers->each(function (Swagger $swagger) use ($version) {
221 221
                 $directory = __DIR__ . '/Generated/' . $version;
222 222
 
223 223
                 echo "Writing " . $swagger->getTitle() . "\n";
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
                     ->sort();
236 236
 
237 237
                 file_put_contents($directory . '/map.json', $map->toJson());
238
-           });
238
+            });
239 239
 }
240 240
 
241 241
 
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 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,14 +67,14 @@  discard block
 block discarded – undo
67 67
         foreach ($attributes['properties'] as $property => $keys) {
68 68
             $type = $this->parseType($keys);
69 69
 
70
-            $casts .= "\n        '" . $property . "' => '" . $type . "',";
71
-            $properties .= "\n * @property " . $type . ' $' . $property;
70
+            $casts .= "\n        '".$property."' => '".$type."',";
71
+            $properties .= "\n * @property ".$type.' $'.$property;
72 72
         }
73 73
 
74 74
         $model = preg_replace('|{{ Namespace }}|u', $this->getNamespace(), $template);
75 75
         $model = preg_replace('|{{ Version }}|u', $this->version, $model);
76 76
         $model = preg_replace('|{{ Class }}|u', $class, $model);
77
-        $model = preg_replace('|{{ Description }}|u', $attributes['description'] ?? 'Model for ' . $class, $model);
77
+        $model = preg_replace('|{{ Description }}|u', $attributes['description'] ?? 'Model for '.$class, $model);
78 78
         $model = preg_replace('|{{ Casts }}|u', $casts, $model);
79 79
         $model = preg_replace('|{{ Properties }}|u', $properties, $model);
80 80
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
         $this->swaggers = collect([]);
189 189
 
190
-        foreach (glob(__DIR__ . "/swagger/" . $this->version . "/*.json") as $swaggerfile) {
190
+        foreach (glob(__DIR__."/swagger/".$this->version."/*.json") as $swaggerfile) {
191 191
             $this->swaggers->push(new Swagger($swaggerfile, $this->version));
192 192
         }
193 193
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     public function process()
198 198
     {
199 199
         $this->swaggers->each(
200
-            function (Swagger $swagger) {
200
+            function(Swagger $swagger) {
201 201
                 $swagger->parseDefinitions();
202 202
 
203 203
                 $swagger->parsePaths();
@@ -211,30 +211,30 @@  discard block
 block discarded – undo
211 211
 /** @var Loader $loader */
212 212
 $loader = new Loader();
213 213
 
214
-foreach (glob(__DIR__ . "/swagger/*") as $version) {
214
+foreach (glob(__DIR__."/swagger/*") as $version) {
215 215
     $version = basename($version);
216 216
 
217 217
     echo "Working on version ${version}\n";
218 218
 
219 219
     $loader->loadVersion($version)
220
-           ->process()->swaggers->each(function (Swagger $swagger) use ($version) {
221
-                $directory = __DIR__ . '/Generated/' . $version;
220
+           ->process()->swaggers->each(function(Swagger $swagger) use ($version) {
221
+                $directory = __DIR__.'/Generated/'.$version;
222 222
 
223
-                echo "Writing " . $swagger->getTitle() . "\n";
223
+                echo "Writing ".$swagger->getTitle()."\n";
224 224
 
225
-                mkdir($directory . '/' . $swagger->getTitle(), 0755, true);
225
+                mkdir($directory.'/'.$swagger->getTitle(), 0755, true);
226 226
 
227
-                $swagger->models->each(function ($contents, $model) use ($directory, $swagger) {
228
-                    file_put_contents($directory . '/' . $swagger->getTitle() . '/' . $model . '.php', $contents);
227
+                $swagger->models->each(function($contents, $model) use ($directory, $swagger) {
228
+                    file_put_contents($directory.'/'.$swagger->getTitle().'/'.$model.'.php', $contents);
229 229
                 });
230 230
 
231 231
                 echo "Appending map\n";
232 232
 
233
-                $map = collect(json_decode(@ file_get_contents($directory . '/map.json'), true))
233
+                $map = collect(json_decode(@ file_get_contents($directory.'/map.json'), true))
234 234
                     ->merge($swagger->map)
235 235
                     ->sort();
236 236
 
237
-                file_put_contents($directory . '/map.json', $map->toJson());
237
+                file_put_contents($directory.'/map.json', $map->toJson());
238 238
            });
239 239
 }
240 240
 
Please login to merge, or discard this patch.