Completed
Push — main ( 661ea7...761c95 )
by Dylan
03:03 queued 03:03
created
src/CurlResponse.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,9 @@
 block discarded – undo
40 40
     public function getJSON(): ?array
41 41
     {
42 42
         $data = json_decode($this->result, true);
43
-        if (!is_array($data)) return null;
43
+        if (!is_array($data)) {
44
+            return null;
45
+        }
44 46
         
45 47
         return $data;
46 48
     }
Please login to merge, or discard this patch.
src/factory/ServiceFactory.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,9 @@
 block discarded – undo
19 19
     public static function inst(Connector $connector, string $service): ?ApiService
20 20
     {
21 21
         $service = strtolower($service);
22
-        if (!array_key_exists($service, ClassMap::SERVICES)) return null;
22
+        if (!array_key_exists($service, ClassMap::SERVICES)) {
23
+            return null;
24
+        }
23 25
 
24 26
         $cls = ClassMap::SERVICES[$service];
25 27
         return new $cls($connector);
Please login to merge, or discard this patch.
src/services/ApiService.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,7 +98,9 @@
 block discarded – undo
98 98
     {
99 99
         $curl = $this->getClient()->curl_api($url, 'DELETE', $params);
100 100
 
101
-        if ($curl->isValid()) return true;
101
+        if ($curl->isValid()) {
102
+            return true;
103
+        }
102 104
 
103 105
         throw new ApiException($curl->getError());
104 106
     }
Please login to merge, or discard this patch.
src/models/Address.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,9 @@
 block discarded – undo
59 59
      */
60 60
     public function Customer(): ?Customer
61 61
     {
62
-        if (!$this->CustomerID) return null;
62
+        if (!$this->CustomerID) {
63
+            return null;
64
+        }
63 65
 
64 66
         /** @var Customer|null $customer */
65 67
         $customer = $this->getClient()->customers->fetch($this->CustomerID);
Please login to merge, or discard this patch.
src/resource/SimpleList.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 
43 43
             foreach ($list as $item) {
44 44
                 $obj = ObjectFactory::make($this->getClient(), $item);
45
-                if (!$obj) continue;
45
+                if (!$obj) {
46
+                    continue;
47
+                }
46 48
 
47 49
                 $this->_items[] = $obj;
48 50
             }
@@ -76,6 +78,8 @@  discard block
 block discarded – undo
76 78
      */
77 79
     public function first(): ?Model
78 80
     {
79
-        foreach ($this as $obj) return $obj;
81
+        foreach ($this as $obj) {
82
+            return $obj;
83
+        }
80 84
     }
81 85
 }
Please login to merge, or discard this patch.
src/factory/ObjectFactory.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@  discard block
 block discarded – undo
21 21
     public static function create(Connector $connector, string $model, array $data = []): Model
22 22
     {
23 23
         $model = strtolower($model);
24
-        if (!array_key_exists($model, ClassMap::MODELS)) return new LifeboatModel($connector, $data);
24
+        if (!array_key_exists($model, ClassMap::MODELS)) {
25
+            return new LifeboatModel($connector, $data);
26
+        }
25 27
 
26 28
         $cls = ClassMap::MODELS[$model];
27 29
         return new $cls($connector, $data);
@@ -35,7 +37,9 @@  discard block
 block discarded – undo
35 37
     public static function make(Connector $connector, array $data): Model
36 38
     {
37 39
         $model = $data['model'] ?? '';
38
-        if (!$model) return new LifeboatModel($connector, $data);
40
+        if (!$model) {
41
+            return new LifeboatModel($connector, $data);
42
+        }
39 43
         return self::create($connector, $model, $data);
40 44
     }
41 45
 }
Please login to merge, or discard this patch.
src/includes/functions.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@
 block discarded – undo
6 6
  */
7 7
 function lifeboat_date_formatter(string $date): ?DateTime
8 8
 {
9
-    if (!$date) return null;
9
+    if (!$date) {
10
+        return null;
11
+    }
10 12
 
11 13
     try {
12 14
         $date = new \DateTime($date . ' CET');
Please login to merge, or discard this patch.
tests/UtilsTest.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,9 @@
 block discarded – undo
68 68
 
69 69
         // Test the randomness
70 70
         $generated = [];
71
-        while (count($generated) < 100000) $generated[] = Utils::create_random_string();
71
+        while (count($generated) < 100000) {
72
+            $generated[] = Utils::create_random_string();
73
+        }
72 74
         $count  = count($generated);
73 75
         $unique = count(array_unique($generated));
74 76
         $random = 100 - ((100 / $count) * $unique);
Please login to merge, or discard this patch.
src/utils/Curl.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,8 +40,12 @@  discard block
 block discarded – undo
40 40
     public function __construct(string $url, array $data = [], array $headers = [])
41 41
     {
42 42
         $this->setURL($url);
43
-        foreach ($data as $name => $value)      $this->addDataParam($name, $value);
44
-        foreach ($headers as $name => $value)   $this->addHeader($name, $value);
43
+        foreach ($data as $name => $value) {
44
+            $this->addDataParam($name, $value);
45
+        }
46
+        foreach ($headers as $name => $value) {
47
+            $this->addHeader($name, $value);
48
+        }
45 49
     }
46 50
 
47 51
     /**
@@ -100,7 +104,9 @@  discard block
 block discarded – undo
100 104
 
101 105
     public function removeDataParam(string $name): Curl
102 106
     {
103
-        if (array_key_exists($name, $this->_data)) unset($this->_data[$name]);
107
+        if (array_key_exists($name, $this->_data)) {
108
+            unset($this->_data[$name]);
109
+        }
104 110
         return $this;
105 111
     }
106 112
 
@@ -129,7 +135,9 @@  discard block
 block discarded – undo
129 135
      */
130 136
     public function removeHeader(string $name): Curl
131 137
     {
132
-        if (array_key_exists($name, $this->_headers)) unset($this->_headers[$name]);
138
+        if (array_key_exists($name, $this->_headers)) {
139
+            unset($this->_headers[$name]);
140
+        }
133 141
         return $this;
134 142
     }
135 143
 
@@ -173,13 +181,17 @@  discard block
 block discarded – undo
173 181
         $request_uri    = $this->getURL();
174 182
 
175 183
         //  Headers
176
-        foreach ($this->getHeaders() as $k => $v) $send_headers[] = "{$k}: {$v}";
184
+        foreach ($this->getHeaders() as $k => $v) {
185
+            $send_headers[] = "{$k}: {$v}";
186
+        }
177 187
 
178 188
         // Request Data
179 189
         switch ($this->getMethod()) {
180 190
             case 'GET':
181 191
             case 'DELETE':
182
-                foreach ($this->getDataParams() as $name => $value) $request_uri = URL::setGetVar($name, $value, $request_uri);
192
+                foreach ($this->getDataParams() as $name => $value) {
193
+                    $request_uri = URL::setGetVar($name, $value, $request_uri);
194
+                }
183 195
                 break;
184 196
 
185 197
             case 'POST':
@@ -210,7 +222,9 @@  discard block
 block discarded – undo
210 222
         curl_setopt($ch, CURLINFO_HEADER_OUT, true);
211 223
         curl_setopt($ch, CURLOPT_AUTOREFERER, true);
212 224
 
213
-        if (!empty($send_headers))  curl_setopt($ch, CURLOPT_HTTPHEADER, $send_headers);
225
+        if (!empty($send_headers)) {
226
+            curl_setopt($ch, CURLOPT_HTTPHEADER, $send_headers);
227
+        }
214 228
         if (!is_null($post_data))   {
215 229
             curl_setopt($ch, CURLOPT_POST, 1);
216 230
             curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
@@ -220,7 +234,9 @@  discard block
 block discarded – undo
220 234
         $http_code  = curl_getinfo($ch, CURLINFO_HTTP_CODE);
221 235
 
222 236
         $response = new CurlResponse((int) $http_code, (string) $result);
223
-        if ($this->_enable_cache && isset($cache_key)) self::$_cache[$cache_key] = $response;
237
+        if ($this->_enable_cache && isset($cache_key)) {
238
+            self::$_cache[$cache_key] = $response;
239
+        }
224 240
 
225 241
         return $response;
226 242
     }
Please login to merge, or discard this patch.