Passed
Push — main ( 383cbf...40aa9a )
by Dylan
02:01
created
src/utils/URL.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
     public static function setGetVar(string $key, string $value, string $url): string
21 21
     {
22 22
         if (!self::is_absolute_url($url)) {
23
-            $url = 'http://dummy.com/' . ltrim($url, '/');
23
+            $url = 'http://dummy.com/'.ltrim($url, '/');
24 24
         }
25 25
 
26 26
         // try to parse uri
27 27
         $parts = parse_url($url);
28 28
         if (empty($parts)) {
29
-            throw new InvalidArgumentException("Can't parse URL: " . $url);
29
+            throw new InvalidArgumentException("Can't parse URL: ".$url);
30 30
         }
31 31
 
32 32
         // Parse params and add new variable
@@ -40,18 +40,18 @@  discard block
 block discarded – undo
40 40
         // Generate URI segments and formatting
41 41
         $scheme = (array_key_exists('scheme', $parts)) ? $parts['scheme'] : 'http';
42 42
         $user = (array_key_exists('user', $parts)) ? $parts['user'] : '';
43
-        $port = (array_key_exists('port', $parts) && $parts['port']) ? ':' . $parts['port'] : '';
43
+        $port = (array_key_exists('port', $parts) && $parts['port']) ? ':'.$parts['port'] : '';
44 44
 
45 45
         if ($user != '') {
46 46
             // format in either user:[email protected] or [email protected]
47
-            $user .= (array_key_exists('pass', $parts) && $parts['pass']) ? ':' . $parts['pass'] . '@' : '';
47
+            $user .= (array_key_exists('pass', $parts) && $parts['pass']) ? ':'.$parts['pass'].'@' : '';
48 48
         }
49 49
 
50 50
         // handle URL params which are existing / new
51
-        $params = ($params) ? '?' . http_build_query($params) : '';
51
+        $params = ($params) ? '?'.http_build_query($params) : '';
52 52
 
53 53
         // Recompile URI segments
54
-        $newUri = $scheme . '://' . $user . $parts['host'] . $port . $parts['path'] . $params;
54
+        $newUri = $scheme.'://'.$user.$parts['host'].$port.$parts['path'].$params;
55 55
 
56 56
         return str_replace('http://dummy.com/', '', $newUri);
57 57
     }
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
     {
65 65
         // Strip off the query and fragment parts of the URL before checking
66 66
         if (($queryPosition = strpos($url, '?')) !== false) {
67
-            $url = substr($url, 0, $queryPosition - 1);
67
+            $url = substr($url, 0, $queryPosition-1);
68 68
         }
69 69
         if (($hashPosition = strpos($url, '#')) !== false) {
70
-            $url = substr($url, 0, $hashPosition - 1);
70
+            $url = substr($url, 0, $hashPosition-1);
71 71
         }
72 72
         $colonPosition = strpos($url, ':');
73 73
         $slashPosition = strpos($url, '/');
Please login to merge, or discard this patch.
src/utils/Utils.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
         $randomString = '';
18 18
 
19 19
         for ($i = 0; $i < $length; $i++) {
20
-            $randomString .= $characters[rand(0, $charactersLength - 1)];
20
+            $randomString .= $characters[rand(0, $charactersLength-1)];
21 21
         }
22 22
 
23 23
         return $randomString;
@@ -29,6 +29,6 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public static function pack(string $str): string
31 31
     {
32
-        return rtrim(strtr(base64_encode(pack('H*',  hash('sha256', $str))), '+/', '-_'), '=');
32
+        return rtrim(strtr(base64_encode(pack('H*', hash('sha256', $str))), '+/', '-_'), '=');
33 33
     }
34 34
 }
Please login to merge, or discard this patch.
src/App.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
83 83
 
84 84
         if (!$response->isValid() || !$json || !array_key_exists('access_token', $json)) {
85 85
             return $json['access_token'];
86
-        } else {
86
+        }else {
87 87
             return '';
88 88
         }
89 89
     }
Please login to merge, or discard this patch.
src/utils/Curl.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         }
189 189
 
190 190
         if ($this->_enable_cache && $this->getMethod() === 'GET') {
191
-            $cache_key = urlencode($request_uri) . implode(',', $send_headers);
191
+            $cache_key = urlencode($request_uri).implode(',', $send_headers);
192 192
             if (array_key_exists($cache_key, self::$_cache)) {
193 193
                 return self::$_cache[$cache_key];
194 194
             }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
         curl_setopt($ch, CURLOPT_AUTOREFERER, true);
209 209
 
210 210
         if (!empty($send_headers))  curl_setopt($ch, CURLOPT_HTTPHEADER, $send_headers);
211
-        if (!is_null($post_data))   {
211
+        if (!is_null($post_data)) {
212 212
             curl_setopt($ch, CURLOPT_POST, 1);
213 213
             curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
214 214
         }
Please login to merge, or discard this patch.
src/resource/ListResource.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -190,20 +190,20 @@
 block discarded – undo
190 190
         $t = $this->getItems(1);
191 191
         $c = $this->count();
192 192
 
193
-        return (function () use ($t, $c) {
193
+        return (function() use ($t, $c) {
194 194
             $i = 0;
195 195
             $x = 0;
196 196
 
197 197
             while ($i < $c) {
198 198
                 if ($x === 0) {
199 199
                     $x = $this->_page_length;
200
-                    $t = $this->getItems(floor($i / $this->_page_length) + 1);
200
+                    $t = $this->getItems(floor($i / $this->_page_length)+1);
201 201
                 }
202 202
 
203
-                yield $i => $t[$this->_page_length - $x];
203
+                yield $i => $t[$this->_page_length-$x];
204 204
 
205 205
                 $x -= 1;
206
-                $i ++;
206
+                $i++;
207 207
             }
208 208
         })();
209 209
     }
Please login to merge, or discard this patch.
src/Connector.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     public function curl_api(string $url, string $method = 'GET', array $data = [], array $headers = []): CurlResponse
108 108
     {
109 109
         $url = URL::is_absolute_url($url) ? $url
110
-            : 'https://' . rtrim($this->_host, '/') . '/' . ltrim($url, '/');
110
+            : 'https://'.rtrim($this->_host, '/').'/'.ltrim($url, '/');
111 111
 
112 112
         $curl = new Curl($url, $data, $headers);
113 113
 
@@ -126,6 +126,6 @@  discard block
 block discarded – undo
126 126
      */
127 127
     protected function auth_url(string $path): string
128 128
     {
129
-        return $this->_auth_domain . '/' . ltrim($path, '/');
129
+        return $this->_auth_domain.'/'.ltrim($path, '/');
130 130
     }
131 131
 }
Please login to merge, or discard this patch.
src/services/Orders.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
             throw new InvalidArgumentException("{$class}::fetch() expects parameter 1 to be a positive integer");
43 43
         }
44 44
 
45
-        return $this->retrieve('api/orders/order/' . $id);
45
+        return $this->retrieve('api/orders/order/'.$id);
46 46
     }
47 47
 
48 48
     /**
Please login to merge, or discard this patch.
src/models/Order.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
      */
16 16
     protected function getSaveURL(): string
17 17
     {
18
-        return 'api/orders/order/' . $this->ID;
18
+        return 'api/orders/order/'.$this->ID;
19 19
     }
20 20
 }
Please login to merge, or discard this patch.
src/models/Model.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
                     // Model or Object
39 39
                     if (!array_key_exists('field_name', $value)) {
40 40
                         $this->$field = ObjectFactory::make($client, $value);
41
-                    } else {
41
+                    }else {
42 42
                         // Has One Relation - Deprecated
43 43
                         $name = $value['field_name'];
44 44
                         $this->$name    = $value['field_value'];
@@ -49,20 +49,20 @@  discard block
 block discarded – undo
49 49
                     if (!property_exists($this->$field, $model)) {
50 50
                         $this->$field->$model = $this;
51 51
                     }
52
-                } else {
52
+                }else {
53 53
                     // HasMany / ManyMany Relation
54 54
                     $list = [];
55 55
                     foreach ($value as $item) {
56 56
                         if (ArrayLib::is_associative($item)) {
57 57
                             $list = ObjectFactory::make($client, $item);
58
-                        } else {
58
+                        }else {
59 59
                             $list = $item;
60 60
                         }
61 61
                     }
62 62
 
63 63
                     $this->$field = $list;
64 64
                 }
65
-            } else {
65
+            }else {
66 66
                 $this->$field = $value;
67 67
             }
68 68
         }
Please login to merge, or discard this patch.