Passed
Push — main ( 5cc9d7...38cdcf )
by Dylan
02:35
created
src/App.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -115,7 +115,9 @@  discard block
 block discarded – undo
115 115
      */
116 116
     public function getAPIChallenge(bool $check_session = true): string
117 117
     {
118
-        if ($this->_api_challenge) return $this->_api_challenge;
118
+        if ($this->_api_challenge) {
119
+            return $this->_api_challenge;
120
+        }
119 121
 
120 122
         if ($check_session && session_status() === PHP_SESSION_ACTIVE) {
121 123
             $this->setAPIChallenge($_SESSION[self::API_CHALLENGE_PARAM] ?? '');
@@ -162,7 +164,9 @@  discard block
 block discarded – undo
162 164
         $json = $response->getJSON();
163 165
         
164 166
         if (!$response->isValid() || !$json || !array_key_exists('access_token', $json)) {
165
-            if (array_key_exists('error', $json)) throw new OAuthException($json['error']);
167
+            if (array_key_exists('error', $json)) {
168
+                throw new OAuthException($json['error']);
169
+            }
166 170
             return '';
167 171
         } else {
168 172
             $this->setAccessToken($json['access_token']);
@@ -184,7 +188,9 @@  discard block
 block discarded – undo
184 188
      */
185 189
     public function getAccessToken(bool $check_session = true): string
186 190
     {
187
-        if ($this->_access_token) return $this->_access_token;
191
+        if ($this->_access_token) {
192
+            return $this->_access_token;
193
+        }
188 194
 
189 195
         if ($check_session && session_status() === PHP_SESSION_ACTIVE) {
190 196
             $this->setAccessToken($_SESSION[self::ACCESS_TOKEN_PARAM] ?? '');
Please login to merge, or discard this patch.
src/Connector.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -60,7 +60,9 @@  discard block
 block discarded – undo
60 60
     public function __get(string $service): ?ApiService
61 61
     {
62 62
         $obj = ServiceFactory::inst($this, $service);
63
-        if (!$obj) throw new BadMethodException("Service for `{$service}` does not exist");
63
+        if (!$obj) {
64
+            throw new BadMethodException("Service for `{$service}` does not exist");
65
+        }
64 66
 
65 67
         return $obj;
66 68
     }
@@ -118,7 +120,9 @@  discard block
 block discarded – undo
118 120
      */
119 121
     public function getHost(): ?string
120 122
     {
121
-        if (!$this->getActiveSite(true)) return null;
123
+        if (!$this->getActiveSite(true)) {
124
+            return null;
125
+        }
122 126
         return $this->_host;
123 127
     }
124 128
 
@@ -127,7 +131,9 @@  discard block
 block discarded – undo
127 131
      */
128 132
     public function getSiteKey(): ?string
129 133
     {
130
-        if (!$this->getActiveSite(true)) return null;
134
+        if (!$this->getActiveSite(true)) {
135
+            return null;
136
+        }
131 137
         return $this->_site_key;
132 138
     }
133 139
 
@@ -151,7 +157,9 @@  discard block
 block discarded – undo
151 157
         $curl->addHeader('Host', $this->getHost());
152 158
 
153 159
         foreach ($this->getAuthHeaders() as $header => $value) {
154
-            if ($value) $curl->addHeader($header, $value);
160
+            if ($value) {
161
+                $curl->addHeader($header, $value);
162
+            }
155 163
         }
156 164
 
157 165
         return $curl->curl_json();
@@ -163,8 +171,12 @@  discard block
 block discarded – undo
163 171
      */
164 172
     public function getAuthHeaders(): array
165 173
     {
166
-        if (!$this->getAccessToken()) $this->fetchAccessToken();
167
-        if (!$this->getAccessToken()) throw new OAuthException("Access token has not been retreived");
174
+        if (!$this->getAccessToken()) {
175
+            $this->fetchAccessToken();
176
+        }
177
+        if (!$this->getAccessToken()) {
178
+            throw new OAuthException("Access token has not been retreived");
179
+        }
168 180
 
169 181
         return [
170 182
             'access-token'  => $this->getAccessToken(),
Please login to merge, or discard this patch.