Test Failed
Push — main ( e6678b...02f88a )
by Dylan
09:26
created
src/resource/ListResource.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -129,16 +129,22 @@  discard block
 block discarded – undo
129 129
             $response   = $this->getClient()->curl_api($this->getURL(), 'GET', $data);
130 130
             $data       = ($response->isValid() && $response->isJSON()) ? $response->getJSON() : [];
131 131
 
132
-            if (empty($data)) throw new ApiException($response->getError());
132
+            if (empty($data)) {
133
+                throw new ApiException($response->getError());
134
+            }
133 135
 
134 136
             $this->_max_items = (int) $data['available_items'];
135 137
 
136
-            if (empty($data['items'])) return $this->_items[$page] = [];
138
+            if (empty($data['items'])) {
139
+                return $this->_items[$page] = [];
140
+            }
137 141
 
138 142
 
139 143
             foreach ($data['items'] as $item) {
140 144
                 $obj = ObjectFactory::make($this->getClient(), $item);
141
-                if (!$obj) continue;
145
+                if (!$obj) {
146
+                    continue;
147
+                }
142 148
 
143 149
                 $this->_items[$page][] = $obj;
144 150
             }
@@ -153,7 +159,9 @@  discard block
 block discarded – undo
153 159
      */
154 160
     public function offsetGet($offset): ?ObjectResource
155 161
     {
156
-        foreach ($this as $i => $obj) if ($i === $offset) return $obj;
162
+        foreach ($this as $i => $obj) {
163
+            if ($i === $offset) return $obj;
164
+        }
157 165
         return null;
158 166
     }
159 167
 
@@ -184,7 +192,9 @@  discard block
 block discarded – undo
184 192
      */
185 193
     public function offsetExists($offset): bool
186 194
     {
187
-        foreach ($this as $i => $obj) if ($offset === $i) return true;
195
+        foreach ($this as $i => $obj) {
196
+            if ($offset === $i) return true;
197
+        }
188 198
         return false;
189 199
     }
190 200
 
@@ -240,6 +250,8 @@  discard block
 block discarded – undo
240 250
      */
241 251
     public function first(): ?Model
242 252
     {
243
-        foreach ($this as $obj) return $obj;
253
+        foreach ($this as $obj) {
254
+            return $obj;
255
+        }
244 256
     }
245 257
 }
Please login to merge, or discard this patch.
src/App.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     public function __construct(string $app_id, string $app_secret, $auth_domain = self::AUTH_DOMAIN)
26 26
     {
27 27
         if (!$app_id || !$app_secret) {
28
-            throw new InvalidArgumentException(static::class . "expects an app_id and app_secret");
28
+            throw new InvalidArgumentException(static::class."expects an app_id and app_secret");
29 29
         }
30 30
 
31 31
         $this->setAppID($app_id);
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
         if (!$response->isValid() || !$json || !array_key_exists('access_token', $json)) {
159 159
             return '';
160
-        } else {
160
+        }else {
161 161
             $this->setAccessToken($json['access_token']);
162 162
             return $this->getAccessToken(false);
163 163
         }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,7 +109,9 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function getAPIChallenge(bool $check_session = true): string
111 111
     {
112
-        if ($this->_api_challenge) return $this->_api_challenge;
112
+        if ($this->_api_challenge) {
113
+            return $this->_api_challenge;
114
+        }
113 115
 
114 116
         if ($check_session && session_status() === PHP_SESSION_ACTIVE) {
115 117
             $this->setAPIChallenge($_SESSION[self::API_CHALLENGE_PARAM] ?? '');
@@ -169,7 +171,9 @@  discard block
 block discarded – undo
169 171
      */
170 172
     public function getAccessToken(bool $check_session = true): string
171 173
     {
172
-        if ($this->_access_token) return $this->_access_token;
174
+        if ($this->_access_token) {
175
+            return $this->_access_token;
176
+        }
173 177
 
174 178
         if ($check_session && session_status() === PHP_SESSION_ACTIVE) {
175 179
             $this->setAccessToken($_SESSION[self::ACCESS_TOKEN_PARAM] ?? '');
Please login to merge, or discard this patch.
src/Connector.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace Lifeboat;
4 4
 
5
-require_once __DIR__ . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'functions.php';
5
+require_once __DIR__.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR.'functions.php';
6 6
 
7 7
 use Lifeboat\Exceptions\BadMethodException;
8 8
 use Lifeboat\Exceptions\OAuthException;
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     public function curl_api(string $url, string $method = 'GET', array $data = [], array $headers = []): CurlResponse
166 166
     {
167 167
         $url = URL::is_absolute_url($url) ? $url
168
-            : 'https://' . rtrim($this->getHost(), '/') . '/' . ltrim($url, '/');
168
+            : 'https://'.rtrim($this->getHost(), '/').'/'.ltrim($url, '/');
169 169
 
170 170
         $curl = new Curl($url, $data, $headers);
171 171
 
@@ -184,6 +184,6 @@  discard block
 block discarded – undo
184 184
      */
185 185
     protected function auth_url(string $path): string
186 186
     {
187
-        return rtrim($this->_auth_domain, '/') . '/' . ltrim($path, '/');
187
+        return rtrim($this->_auth_domain, '/').'/'.ltrim($path, '/');
188 188
     }
189 189
 }
Please login to merge, or discard this patch.