@@ -35,7 +35,7 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function apiKeyGenerate($length = 32) |
| 37 | 37 | { |
| 38 | - $randInt = microtime().rand(1000, 9999); |
|
| 38 | + $randInt = microtime() . rand(1000, 9999); |
|
| 39 | 39 | $messageDigest = md5($randInt); |
| 40 | 40 | return implode( |
| 41 | 41 | '-', |
@@ -215,7 +215,7 @@ |
||
| 215 | 215 | if ($nLeakRate < 0) { |
| 216 | 216 | $nLeakRate = 0; |
| 217 | 217 | } |
| 218 | - $this->leakage = (float)$nLeakRate; |
|
| 218 | + $this->leakage = (float) $nLeakRate; |
|
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
@@ -138,7 +138,7 @@ |
||
| 138 | 138 | |
| 139 | 139 | if (is_numeric($timeframe)) { |
| 140 | 140 | if ($timeframe < 0) { |
| 141 | - $timeframe = ($timeframe*-1); |
|
| 141 | + $timeframe = ($timeframe * -1); |
|
| 142 | 142 | } |
| 143 | 143 | self::$timeframe['CUSTOM'] = $timeframe; |
| 144 | 144 | $this->window = intval(self::$timeframe['CUSTOM']); |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $bucket->getTokenData() |
| 212 | 212 | ); |
| 213 | 213 | |
| 214 | - if($this->isMockTest) { |
|
| 214 | + if ($this->isMockTest) { |
|
| 215 | 215 | return; |
| 216 | 216 | } |
| 217 | 217 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function getAccount() |
| 259 | 259 | { |
| 260 | - if($this->isMockTest) { |
|
| 260 | + if ($this->isMockTest) { |
|
| 261 | 261 | $this->getMockAccount(); |
| 262 | 262 | } |
| 263 | 263 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | $mockAccount = []; |
| 283 | 283 | |
| 284 | - if(!isset($mockAccount['bucket'])) { |
|
| 284 | + if (!isset($mockAccount['bucket'])) { |
|
| 285 | 285 | $mockAccount['bucket'] = $packer->pack( |
| 286 | 286 | $bucket->getTokenData() |
| 287 | 287 | ); |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | $mockAccount['access'] = time(); |
| 291 | 291 | |
| 292 | - $this->setAccount((object)$mockAccount); |
|
| 293 | - $this->mockAccount = (object)$mockAccount; |
|
| 292 | + $this->setAccount((object) $mockAccount); |
|
| 293 | + $this->mockAccount = (object) $mockAccount; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /** |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | * @var array |
| 53 | 53 | */ |
| 54 | 54 | protected static $ALGORITHMS = [ |
| 55 | - 'HS256','sha256', |
|
| 56 | - 'HS384','sha384', |
|
| 57 | - 'HS512','sha512', |
|
| 55 | + 'HS256', 'sha256', |
|
| 56 | + 'HS384', 'sha384', |
|
| 57 | + 'HS512', 'sha512', |
|
| 58 | 58 | ]; |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * [getOptions] |
| 253 | 253 | * @return array |
| 254 | 254 | */ |
| 255 | - public function getOptions():?array |
|
| 255 | + public function getOptions(): ?array |
|
| 256 | 256 | { |
| 257 | 257 | return self::$options; |
| 258 | 258 | } |
@@ -156,8 +156,8 @@ |
||
| 156 | 156 | public static function getRequestVerb():string |
| 157 | 157 | { |
| 158 | 158 | $helper = new helper; |
| 159 | - $method = $helper->checkVal(@$_SERVER, 'REQUEST_METHOD', '' ); |
|
| 160 | - $method = $helper->checkVal(@$_SERVER, 'HTTP_X_HTTP_METHOD', $method ); |
|
| 159 | + $method = $helper->checkVal(@$_SERVER, 'REQUEST_METHOD', ''); |
|
| 160 | + $method = $helper->checkVal(@$_SERVER, 'HTTP_X_HTTP_METHOD', $method); |
|
| 161 | 161 | |
| 162 | 162 | return strtolower($method); |
| 163 | 163 | } |
@@ -157,7 +157,7 @@ |
||
| 157 | 157 | |
| 158 | 158 | $headers = new headers\header; |
| 159 | 159 | $headers->setOptions($options); |
| 160 | - $headers->setHeaders($corsAllowed&&$isCorsRequest); |
|
| 160 | + $headers->setHeaders($corsAllowed && $isCorsRequest); |
|
| 161 | 161 | |
| 162 | 162 | http_response_code($this->ERROR_STATE['ERROR_CODE']); |
| 163 | 163 | |
@@ -256,7 +256,7 @@ |
||
| 256 | 256 | { |
| 257 | 257 | $corsAllowed = ($this->getOptions()['cors']) ?? false; |
| 258 | 258 | $isCorsRequest = ($_SERVER['HTTP_ORIGIN']) ?? false; |
| 259 | - $this->setHeaders($corsAllowed&&$isCorsRequest); |
|
| 259 | + $this->setHeaders($corsAllowed && $isCorsRequest); |
|
| 260 | 260 | |
| 261 | 261 | $this->setHeader('HTTP/1.1', array( |
| 262 | 262 | 'Unauthorized', |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | { |
| 56 | 56 | $scriptName = ltrim($_SERVER['SCRIPT_NAME']); |
| 57 | 57 | $uri = array_values(array_filter(explode('/', $_SERVER['SCRIPT_NAME']))); |
| 58 | - return '/'.implode('/', array_slice($uri, 0, 1)).'/'; |
|
| 58 | + return '/' . implode('/', array_slice($uri, 0, 1)) . '/'; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | /** |