@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | if (!$response->isValid() || !$json || !array_key_exists('access_token', $json)) { |
| 84 | 84 | $promise->reject($response->getRaw()); |
| 85 | - } else { |
|
| 85 | + }else { |
|
| 86 | 86 | $promise->resolve($json['access_token']); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -124,6 +124,6 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | private function auth_url(string $path): string |
| 126 | 126 | { |
| 127 | - return $this->_auth_domain . '/' . ltrim($path, '/'); |
|
| 127 | + return $this->_auth_domain.'/'.ltrim($path, '/'); |
|
| 128 | 128 | } |
| 129 | 129 | } |
@@ -44,7 +44,9 @@ |
||
| 44 | 44 | */ |
| 45 | 45 | public function getAPIChallenge(): string |
| 46 | 46 | { |
| 47 | - if (!$this->_api_challenge) $this->_api_challenge = Utils::create_random_string(128); |
|
| 47 | + if (!$this->_api_challenge) { |
|
| 48 | + $this->_api_challenge = Utils::create_random_string(128); |
|
| 49 | + } |
|
| 48 | 50 | return $this->_api_challenge; |
| 49 | 51 | } |
| 50 | 52 | |
@@ -67,7 +67,9 @@ |
||
| 67 | 67 | */ |
| 68 | 68 | public function getSites(string $access_token = ''): array |
| 69 | 69 | { |
| 70 | - if (!$access_token) $access_token = $this->getAccessToken(); |
|
| 70 | + if (!$access_token) { |
|
| 71 | + $access_token = $this->getAccessToken(); |
|
| 72 | + } |
|
| 71 | 73 | |
| 72 | 74 | $curl = new Curl($this->auth_url(self::SITES_URL), [ |
| 73 | 75 | 'access_token' => $access_token |
@@ -17,7 +17,7 @@ discard block |
||
| 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 |
||
| 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 | } |