Passed
Pull Request — develop (#25)
by Jimmy
14:33
created
src/Laravel/ConnectWiseMemberIdFromEmail.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,6 +11,6 @@
 block discarded – undo
11 11
      */
12 12
     public function getConnectWiseMemberIdAttribute()
13 13
     {
14
-        return str_replace('.', '', explode('@', $this->email)[0]);
14
+        return str_replace('.', '', explode('@', $this->email)[ 0 ]);
15 15
     }
16 16
 }
Please login to merge, or discard this patch.
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   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -173,9 +173,9 @@
 block discarded – undo
173 173
     protected function parse($token)
174 174
     {
175 175
         // TODO: Put guard here to make sure that we got a token.
176
-        $this->setExpiration($token['expiration']);
177
-        $this->password = $token['privateKey'];
178
-        $this->username = $token['publicKey'];
176
+        $this->setExpiration($token[ 'expiration' ]);
177
+        $this->password = $token[ 'privateKey' ];
178
+        $this->username = $token[ 'publicKey' ];
179 179
     }
180 180
 
181 181
     /**
Please login to merge, or discard this patch.
generator/generator.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -18,27 +18,27 @@  discard block
 block discarded – undo
18 18
 function determinePropertyType($properties)
19 19
 {
20 20
     if (array_key_exists('format', $properties)) {
21
-        if ('number' == $properties['type']) {
22
-            return $properties['format'];
21
+        if ('number' == $properties[ 'type' ]) {
22
+            return $properties[ 'format' ];
23 23
         }
24 24
 
25
-        if ('string' == $properties['type'] && 'date-time' == $properties['format']) {
25
+        if ('string' == $properties[ 'type' ] && 'date-time' == $properties[ 'format' ]) {
26 26
             return 'carbon';
27 27
         }
28 28
     }
29 29
 
30
-    return $properties['type'];
30
+    return $properties[ 'type' ];
31 31
 }
32 32
 
33 33
 function getDefinitions($definition)
34 34
 {
35 35
     $definition = preg_replace('|^#/definitions/|u', '', $definition);
36 36
 
37
-    if (!array_key_exists($definition, $GLOBALS['swagger']['definitions'])) {
37
+    if (!array_key_exists($definition, $GLOBALS[ 'swagger' ][ 'definitions' ])) {
38 38
         throw new RuntimeException(sprintf("Unexpected definition [%s]", $definition));
39 39
     }
40 40
 
41
-    return $GLOBALS['swagger']['definitions'][$definition]['properties'];
41
+    return $GLOBALS[ 'swagger' ][ 'definitions' ][ $definition ][ 'properties' ];
42 42
 }
43 43
 
44 44
 function getResponse(array $responses, $code = 200)
@@ -49,22 +49,22 @@  discard block
 block discarded – undo
49 49
     }
50 50
 
51 51
     // No schema, so just empty array--no response
52
-    if (!array_key_exists('schema', $responses[$code])) {
53
-        return [];
52
+    if (!array_key_exists('schema', $responses[ $code ])) {
53
+        return [ ];
54 54
     }
55 55
 
56 56
     // Essentially not an array of items
57
-    if (array_key_exists('$ref', $responses[$code]['schema'])) {
58
-        return $responses[$code]['schema'];
57
+    if (array_key_exists('$ref', $responses[ $code ][ 'schema' ])) {
58
+        return $responses[ $code ][ 'schema' ];
59 59
     }
60 60
 
61 61
     // No items, so just empty array--no response
62
-    if (!array_key_exists('items', $responses[$code]['schema'])) {
63
-        return [];
62
+    if (!array_key_exists('items', $responses[ $code ][ 'schema' ])) {
63
+        return [ ];
64 64
     }
65 65
 
66 66
     // Give back the items
67
-    return $responses[$code]['schema']['items'];
67
+    return $responses[ $code ][ 'schema' ][ 'items' ];
68 68
 }
69 69
 
70 70
 function mapResourceToClass($uri, $namespace, $class)
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 function parseResponse($response, $uri)
76 76
 {
77
-    $attributes = [];
77
+    $attributes = [ ];
78 78
 
79 79
     foreach ($response as $name => $item) {
80 80
         if ('$ref' !== $name) {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         foreach ($definition as $attribute => $properties) {
87 87
             // TODO: Handle recursive defs
88 88
             if (!array_key_exists('$ref', $properties)) {
89
-                $attributes[$attribute] = determinePropertyType($properties);
89
+                $attributes[ $attribute ] = determinePropertyType($properties);
90 90
             }
91 91
         }
92 92
     }
@@ -96,26 +96,26 @@  discard block
 block discarded – undo
96 96
 
97 97
 function processPaths()
98 98
 {
99
-    $namespace = Str::studly($GLOBALS['api']);
100
-    $path = __DIR__ . '/Generated/' . $GLOBALS['version'] . '/';
99
+    $namespace = Str::studly($GLOBALS[ 'api' ]);
100
+    $path = __DIR__ . '/Generated/' . $GLOBALS[ 'version' ] . '/';
101 101
 
102 102
     mkdir($path . $namespace, 0755, true);
103 103
 
104
-    foreach ($GLOBALS['swagger']['paths'] as $uri => $actions) {
104
+    foreach ($GLOBALS[ 'swagger' ][ 'paths' ] as $uri => $actions) {
105 105
         if (array_key_exists('get', $actions)) {
106
-            $docs = $actions['get'];
107
-            $class = Str::singular($docs['tags'][0]);
106
+            $docs = $actions[ 'get' ];
107
+            $class = Str::singular($docs[ 'tags' ][ 0 ]);
108 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
-                $attributes = parseResponse(getResponse($docs['responses']), $uri);
113
+                $attributes = parseResponse(getResponse($docs[ 'responses' ]), $uri);
114 114
 
115 115
                 writeClassFile(
116 116
                     $file,
117 117
                     $namespace,
118
-                    $GLOBALS['version'],
118
+                    $GLOBALS[ 'version' ],
119 119
                     $class,
120 120
                     $attributes
121 121
                 );
@@ -173,17 +173,17 @@  discard block
 block discarded – undo
173 173
 }
174 174
 
175 175
 foreach (glob(__DIR__ . "/swagger/*") as $version) {
176
-    $GLOBALS['version'] = basename($version);
177
-    $GLOBALS['map'] = null;
176
+    $GLOBALS[ 'version' ] = basename($version);
177
+    $GLOBALS[ 'map' ] = null;
178 178
 
179
-    foreach (glob(__DIR__ . "/swagger/" . $GLOBALS['version'] . "/*.json") as $swaggerfile) {
180
-        $GLOBALS['api'] = explode('.', basename($swaggerfile))[0];
181
-        $GLOBALS['swagger'] = readSwagger($swaggerfile);
179
+    foreach (glob(__DIR__ . "/swagger/" . $GLOBALS[ 'version' ] . "/*.json") as $swaggerfile) {
180
+        $GLOBALS[ 'api' ] = explode('.', basename($swaggerfile))[ 0 ];
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/Api/Client.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      *
37 37
      * @var array
38 38
      */
39
-    protected $headers = [];
39
+    protected $headers = [ ];
40 40
 
41 41
     /**
42 42
      * Integrator username to make global calls
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             throw new InvalidArgumentException(sprintf("Unsupported verb [%s] was requested.", $verb));
130 130
         }
131 131
 
132
-        return $this->request($verb, $args[0], $args[1] ?? []);
132
+        return $this->request($verb, $args[ 0 ], $args[ 1 ] ?? [ ]);
133 133
     }
134 134
 
135 135
     /**
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     public function addHeader(array $header)
143 143
     {
144 144
         foreach ($header as $key => $value) {
145
-            $this->headers[$key] = $value;
145
+            $this->headers[ $key ] = $value;
146 146
         }
147 147
 
148 148
         return $this;
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      *
176 176
      * @return array
177 177
      */
178
-    public function buildOptions(array $options = [])
178
+    public function buildOptions(array $options = [ ])
179 179
     {
180 180
         return array_merge_recursive(
181 181
             $options,
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      */
206 206
     public function emptyHeaders()
207 207
     {
208
-        $this->setHeaders([]);
208
+        $this->setHeaders([ ]);
209 209
 
210 210
         return $this;
211 211
     }
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 
297 297
             if ($this->isCollection($response)) {
298 298
                 $response = array_map(
299
-                    function ($item) use ($model) {
299
+                    function($item) use ($model) {
300 300
                         $item = new $model($item, $this);
301 301
 
302 302
                         return $item;
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
      * @return Collection|Model|Response
324 324
      * @throws GuzzleException
325 325
      */
326
-    protected function request($method, $resource, array $options = [])
326
+    protected function request($method, $resource, array $options = [ ])
327 327
     {
328 328
         try {
329 329
             $response = $this->guzzle->request($method, $this->buildUri($resource), $this->buildOptions($options));
Please login to merge, or discard this patch.
src/Laravel/ServiceProvider.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -83,9 +83,9 @@
 block discarded – undo
83 83
                     $app->make(Token::class), $app->make(Guzzle::class),
84 84
                     $app->make(ModelResolver::class)
85 85
                 ))->setIntegrator($app->config->get('services.connectwise.integrator'))
86
-                  ->setPassword($app->config->get('services.connectwise.password'))
87
-                  ->setUrl($app->config->get('services.connectwise.url'))
88
-                  ->setVersion($app->config->get('services.connectwise.version'));
86
+                    ->setPassword($app->config->get('services.connectwise.password'))
87
+                    ->setUrl($app->config->get('services.connectwise.url'))
88
+                    ->setVersion($app->config->get('services.connectwise.version'));
89 89
             }
90 90
         );
91 91
     }
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), $app->make(Guzzle::class),
84 84
                     $app->make(ModelResolver::class)
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     {
114 114
         $this->app->singleton(
115 115
             Token::class,
116
-            function (Application $app) {
116
+            function(Application $app) {
117 117
                 return (new Token())->setCompanyId($app->config->get('services.connectwise.company_id'))
118 118
                                     ->setMemberId($this->determineMemberId());
119 119
             }
Please login to merge, or discard this patch.
src/Support/ModelResolver.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      *
15 15
      * @var array
16 16
      */
17
-    protected $maps = [];
17
+    protected $maps = [ ];
18 18
 
19 19
     /**
20 20
      * Find the model to fill with the results from the request
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $uri_parts = parse_url($uri);
40 40
 
41 41
         // Trim "/" off the end
42
-        $pattern = rtrim($uri_parts['path'], '/');
42
+        $pattern = rtrim($uri_parts[ 'path' ], '/');
43 43
 
44 44
         // Replace /(/)d+(/?)/ with /$1{id}$2/
45 45
         $pattern = preg_replace('|(/)\\d+(/?)|u', '$1{id}$2', $pattern);
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
         $pattern = '|^/' . $pattern . '$|ui';
49 49
 
50 50
         // Search the map for the uri that matches
51
-        return ($uri = $this->maps[$version]->search(
52
-            function ($model, $uri) use ($pattern) {
51
+        return ($uri = $this->maps[ $version ]->search(
52
+            function($model, $uri) use ($pattern) {
53 53
                 return preg_match($pattern, $uri);
54 54
             }
55
-        )) ? $this->maps[$version][$uri] : null;
55
+        )) ? $this->maps[ $version ][ $uri ] : null;
56 56
     }
57 57
 
58 58
     /**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     protected function loadVersionIfNeeded($version)
64 64
     {
65 65
         if (!array_key_exists($version, $this->maps)) {
66
-            $this->maps[$version] = collect(
66
+            $this->maps[ $version ] = collect(
67 67
                 json_decode(
68 68
                     @file_get_contents(__DIR__ . '/../Models/v' . str_replace('.', '_', $version) . '/map.json'),
69 69
                     true
Please login to merge, or discard this patch.
src/Support/Model.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
      *
28 28
      * @var array
29 29
      */
30
-    protected $attributes = [];
30
+    protected $attributes = [ ];
31 31
 
32 32
     /**
33 33
      * Properties that need to be casts to a specific object or type
34 34
      *
35 35
      * @var array
36 36
      */
37
-    protected $casts = [];
37
+    protected $casts = [ ];
38 38
 
39 39
     /**
40 40
      * Client instance to go get related properties
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
     {
78 78
         // Call existing method
79 79
         if (method_exists($this, $method)) {
80
-            return call_user_func_array([$this, $method], $arguments);
80
+            return call_user_func_array([ $this, $method ], $arguments);
81 81
         }
82 82
 
83 83
         // Look to see if the property has a relationship to call
84 84
         if ($this->client && is_array($this->{$method}) && array_key_exists('_info', $this->{$method})) {
85
-            foreach ($this->{$method}['_info'] as $k => $v) {
85
+            foreach ($this->{$method}[ '_info' ] as $k => $v) {
86 86
                 if (Str::startsWith($v, $this->client->getUrl())) {
87 87
                     // Cache so that other request will not trigger additional calls
88 88
                     $this->{$method} = $this->client->get(Str::replaceFirst($this->client->getUrl(), '', $v));
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
      */
138 138
     public function __unset($attribute)
139 139
     {
140
-        unset($this->attributes[$attribute]);
140
+        unset($this->attributes[ $attribute ]);
141 141
     }
142 142
 
143 143
     /**
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
             return new Collection((array)$value);
173 173
         }
174 174
 
175
-        if (in_array($cast, ['bool', 'boolean'])) {
175
+        if (in_array($cast, [ 'bool', 'boolean' ])) {
176 176
             return filter_var($value, FILTER_VALIDATE_BOOLEAN);
177 177
         }
178 178
 
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
         }
272 272
 
273 273
         if (isset($this->$attribute)) {
274
-            return $this->attributes[$attribute];
274
+            return $this->attributes[ $attribute ];
275 275
         };
276 276
 
277
-        trigger_error('Undefined property:'. __CLASS__ . '::$' . $attribute);
277
+        trigger_error('Undefined property:' . __CLASS__ . '::$' . $attribute);
278 278
     }
279 279
 
280 280
     /**
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     public function getCasts($attribute = null)
288 288
     {
289 289
         if (array_key_exists($attribute, $this->casts)) {
290
-            return $this->casts[$attribute];
290
+            return $this->casts[ $attribute ];
291 291
         }
292 292
 
293 293
         return $this->casts;
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
             $value = $this->castTo($value, $this->getCasts($attribute));
384 384
         }
385 385
 
386
-        $this->attributes[$attribute] = $value;
386
+        $this->attributes[ $attribute ] = $value;
387 387
 
388 388
         return $this;
389 389
     }
Please login to merge, or discard this patch.