Passed
Push — main ( ffe5d2...2560cc )
by Dylan
02:31
created
tests/factory/ObjectFactoryTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
      */
20 20
     public function testFactory()
21 21
     {
22
-        $mock_data  = ['ID' => 0];
22
+        $mock_data = ['ID' => 0];
23 23
 
24 24
         foreach (ClassMap::MODELS as $name => $class) {
25 25
             $this->assertInstanceOf($class, ObjectFactory::create($this->getMockClient(), $name, $mock_data));
Please login to merge, or discard this patch.
tests/UtilsTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     public function test_is_associative_array()
22 22
     {
23 23
         $this->assertEquals(true, ArrayLib::is_associative(['a' => 1]));
24
-        $this->assertEquals(false, ArrayLib::is_associative([1,2,3]));
24
+        $this->assertEquals(false, ArrayLib::is_associative([1, 2, 3]));
25 25
         $this->assertEquals(false, ArrayLib::is_associative([]));
26 26
 
27 27
         try {
@@ -42,16 +42,16 @@  discard block
 block discarded – undo
42 42
     public function test_set_get_var()
43 43
     {
44 44
         $rel_path = '/path';
45
-        $this->assertEquals($rel_path . '?var=1', URL::setGetVar('var', 1, $rel_path));
45
+        $this->assertEquals($rel_path.'?var=1', URL::setGetVar('var', 1, $rel_path));
46 46
 
47 47
         $rel_path_t = '/path/';
48
-        $this->assertEquals($rel_path_t . '?var=1', URL::setGetVar('var', 1, $rel_path_t));
48
+        $this->assertEquals($rel_path_t.'?var=1', URL::setGetVar('var', 1, $rel_path_t));
49 49
 
50 50
         $absolute = 'https://test.com';
51
-        $this->assertEquals($absolute . '?var=1', URL::setGetVar('var', 1, $absolute));
51
+        $this->assertEquals($absolute.'?var=1', URL::setGetVar('var', 1, $absolute));
52 52
 
53 53
         $absolute_t = 'https://test.com/';
54
-        $this->assertEquals($absolute_t . '?var=1', URL::setGetVar('var', 1, $absolute_t));
54
+        $this->assertEquals($absolute_t.'?var=1', URL::setGetVar('var', 1, $absolute_t));
55 55
     }
56 56
 
57 57
     /**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         while (count($generated) < 100000) $generated[] = Utils::create_random_string();
72 72
         $count  = count($generated);
73 73
         $unique = count(array_unique($generated));
74
-        $random = 100 - ((100 / $count) * $unique);
74
+        $random = 100-((100 / $count) * $unique);
75 75
 
76 76
         // Less than 2% repeat
77 77
         $this->assertTrue($random < 2);
Please login to merge, or discard this patch.
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.
tests/services/ServicesTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -148,7 +148,7 @@
 block discarded – undo
148 148
         string $url,
149 149
         string $list_class = ListResource::class,
150 150
         array $params = []
151
-    ){
151
+    ) {
152 152
         $this->assertInstanceOf($list_class, $all);
153 153
         $this->assertEquals($url, $all->getURL());
154 154
         $this->assertEquals($this->getMockClient(), $all->getClient());
Please login to merge, or discard this patch.
src/utils/Curl.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
     private $_method = 'GET';
22 22
     private $_url    = '';
23 23
     private $_data    = [];
24
-    private $_isfile   = false;
24
+    private $_isfile = false;
25 25
     private $_headers = [
26 26
         'Content-Type'      => 'application/x-www-form-urlencoded',
27 27
         'X-Requested-By'    => self::USER_AGENT
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
         }
192 192
 
193 193
         if ($this->_enable_cache && $this->getMethod() === 'GET') {
194
-            $cache_key = urlencode($request_uri) . implode(',', $send_headers);
194
+            $cache_key = urlencode($request_uri).implode(',', $send_headers);
195 195
             if (array_key_exists($cache_key, self::$_cache)) {
196 196
                 return self::$_cache[$cache_key];
197 197
             }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
         curl_setopt($ch, CURLOPT_AUTOREFERER, true);
212 212
 
213 213
         if (!empty($send_headers))  curl_setopt($ch, CURLOPT_HTTPHEADER, $send_headers);
214
-        if (!is_null($post_data))   {
214
+        if (!is_null($post_data)) {
215 215
             curl_setopt($ch, CURLOPT_POST, 1);
216 216
             curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
217 217
         }
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
@@ -93,6 +93,6 @@
 block discarded – undo
93 93
             default: return '';
94 94
         }
95 95
 
96
-        return ($value !== 0) ?  number_format($value, 2) . $this->Currency : '-';
96
+        return ($value !== 0) ?  number_format($value, 2).$this->Currency : '-';
97 97
     }
98 98
 }
Please login to merge, or discard this patch.
src/services/Orders.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     public function fetch(int $id): ?Order
52 52
     {
53 53
         /** @var Order|null $fetch */
54
-        $fetch = $this->_get('api/orders/order/' . $id);
54
+        $fetch = $this->_get('api/orders/order/'.$id);
55 55
         return $fetch;
56 56
     }
57 57
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     public function update(int $id, array $data): ?Order
79 79
     {
80 80
         /** @var Order|null $post */
81
-        $post = $this->_post('api/orders/order/' . $id, $data);
81
+        $post = $this->_post('api/orders/order/'.$id, $data);
82 82
         return $post;
83 83
     }
84 84
 
Please login to merge, or discard this patch.
src/models/Model.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
                     // Model or Object
36 36
                     if (!array_key_exists('field_name', $value)) {
37 37
                         $this->$field = ObjectFactory::make($client, $value);
38
-                    } else {
38
+                    }else {
39 39
                         // Has One Relation - Deprecated
40 40
                         $name = $value['field_name'];
41 41
                         $this->$name    = $value['field_value'];
42 42
                         $this->$field   = ObjectFactory::make($client, $value['object_data']);
43 43
                     }
44
-                } else {
44
+                }else {
45 45
                     // HasMany / ManyMany Relation
46 46
                     $list = [];
47 47
                     foreach ($value as $item) {
48 48
                         if (ArrayLib::is_associative($item)) {
49 49
                             $list[] = ObjectFactory::make($client, $item);
50
-                        } else {
50
+                        }else {
51 51
                             $list[] = $item;
52 52
                         }
53 53
                     }
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
                 $data[$key] = [];
75 75
                 /** @var self $item */
76 76
                 foreach ($value as $item) $data[$key][] = $item->toArray(true);
77
-            } else $data[$key] = $value;
77
+            }else $data[$key] = $value;
78 78
         }
79 79
 
80 80
         return $data;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             if ($model === static::class) return new $service($this->getClient());
99 99
         }
100 100
 
101
-        throw new ErrorException("Could not determine which service to use for " . static::class);
101
+        throw new ErrorException("Could not determine which service to use for ".static::class);
102 102
     }
103 103
 
104 104
     /**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         if ($this->exists()) {
113 113
             if (!method_exists($service, 'update')) return $this;
114 114
             return $service->update($this->ID, $this->toArray());
115
-        } else {
115
+        }else {
116 116
             if (!method_exists($service, 'create')) return $this;
117 117
             return $service->create($this->toArray());
118 118
         }
Please login to merge, or discard this patch.
src/services/TaxCodes.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public function fetch(int $id): ?TaxCode
23 23
     {
24 24
         /** @var TaxCode|null $fetch */
25
-        $fetch = $this->_get('api/tax_code/' . $id);
25
+        $fetch = $this->_get('api/tax_code/'.$id);
26 26
         return $fetch;
27 27
     }
28 28
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
     public function update(int $id, array $data): ?TaxCode
50 50
     {
51 51
         /** @var TaxCode|null $post */
52
-        $post = $this->_post('api/tax_code/' . $id, $data);
52
+        $post = $this->_post('api/tax_code/'.$id, $data);
53 53
         return $post;
54 54
     }
55 55
 
Please login to merge, or discard this patch.