@@ -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']); |
@@ -66,7 +66,7 @@ |
||
66 | 66 | */ |
67 | 67 | public static function payload(array $payloadObject = []) |
68 | 68 | { |
69 | - if( self::isAnonymousScope($payloadObject) ) { |
|
69 | + if (self::isAnonymousScope($payloadObject)) { |
|
70 | 70 | return true; |
71 | 71 | } |
72 | 72 |
@@ -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 | /** |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $payloadObject = $cipher->jsonDecode($cipher->decode($jwtPayload)); |
52 | 52 | |
53 | 53 | // @codeCoverageIgnoreStart |
54 | - if( $this->key == 'payloadOnly' ) { |
|
54 | + if ($this->key == 'payloadOnly') { |
|
55 | 55 | return $payloadObject; |
56 | 56 | } |
57 | 57 | // @codeCoverageIgnoreEnd |
@@ -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 | } |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | /** |
77 | 77 | * Check if a custom directory was set in the Responsible API options |
78 | 78 | */ |
79 | - if( (isset($options['classRoute']) && !empty($options['classRoute'])) && |
|
79 | + if ((isset($options['classRoute']) && !empty($options['classRoute'])) && |
|
80 | 80 | (isset($options['classRoute']['directory']) && isset($options['classRoute']['namespace'])) |
81 | 81 | ) { |
82 | 82 | $customService = $this->options['classRoute']; |
83 | 83 | $directory = $customService['directory']; |
84 | 84 | $middleware = $customService['namespace']; |
85 | 85 | |
86 | - }else { |
|
86 | + } else { |
|
87 | 87 | $middleware = 'responsible'; |
88 | 88 | |
89 | 89 | $endpoint = str_replace( |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | if (class_exists($child) && method_exists($child, 'register')) { |
142 | 142 | self::$middleWareClass = new $child; |
143 | 143 | $this->registry[$point] = self::$middleWareClass->register(); |
144 | - }else{ |
|
144 | + } else { |
|
145 | 145 | (new exception\errorException) |
146 | 146 | ->setOptions($this->getOptions()) |
147 | 147 | ->message("Class Error:: class {$child} needs to exist. See documentation on setting up a service.") |
@@ -232,16 +232,16 @@ discard block |
||
232 | 232 | * @var array |
233 | 233 | */ |
234 | 234 | if (array_search($endpoint, $this->registry[$api]) !== false) { |
235 | - if( method_exists($this->NAMESPACE_ENDPOINTS[$api], 'scope') ) { |
|
235 | + if (method_exists($this->NAMESPACE_ENDPOINTS[$api], 'scope')) { |
|
236 | 236 | $classScope = (new $this->NAMESPACE_ENDPOINTS[$api])->scope(); |
237 | 237 | $position = array_search($endpoint, $this->registry[$api]); |
238 | 238 | |
239 | - if( is_array($classScope) && isset($classScope[$position]) ) { |
|
239 | + if (is_array($classScope) && isset($classScope[$position])) { |
|
240 | 240 | $endpointSettings['model']['scope'] = $classScope[$position]; |
241 | 241 | |
242 | - }else{ |
|
242 | + } else { |
|
243 | 243 | |
244 | - if( !is_array($classScope) ) { |
|
244 | + if (!is_array($classScope)) { |
|
245 | 245 | $endpointSettings['model']['scope'] = $classScope; |
246 | 246 | } |
247 | 247 | } |
@@ -292,16 +292,16 @@ discard block |
||
292 | 292 | |
293 | 293 | $scope = 'private'; |
294 | 294 | |
295 | - if( method_exists($this->NAMESPACE_ENDPOINTS[$api], 'scope') ) { |
|
295 | + if (method_exists($this->NAMESPACE_ENDPOINTS[$api], 'scope')) { |
|
296 | 296 | $classScope = (new $this->NAMESPACE_ENDPOINTS[$api])->scope(); |
297 | 297 | $position = array_search($path, $this->registry[$api]); |
298 | 298 | |
299 | - if( is_array($classScope) && isset($classScope[$position]) ) { |
|
299 | + if (is_array($classScope) && isset($classScope[$position])) { |
|
300 | 300 | $scope = $classScope[$position]; |
301 | 301 | |
302 | - }else{ |
|
302 | + } else { |
|
303 | 303 | |
304 | - if( !is_array($classScope) ) { |
|
304 | + if (!is_array($classScope)) { |
|
305 | 305 | $scope = $classScope; |
306 | 306 | } |
307 | 307 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $directory = $customService['directory']; |
84 | 84 | $middleware = $customService['namespace']; |
85 | 85 | |
86 | - }else { |
|
86 | + } else { |
|
87 | 87 | $middleware = 'responsible'; |
88 | 88 | |
89 | 89 | $endpoint = str_replace( |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | if (class_exists($child) && method_exists($child, 'register')) { |
142 | 142 | self::$middleWareClass = new $child; |
143 | 143 | $this->registry[$point] = self::$middleWareClass->register(); |
144 | - }else{ |
|
144 | + } else{ |
|
145 | 145 | (new exception\errorException) |
146 | 146 | ->setOptions($this->getOptions()) |
147 | 147 | ->message("Class Error:: class {$child} needs to exist. See documentation on setting up a service.") |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | if( is_array($classScope) && isset($classScope[$position]) ) { |
240 | 240 | $endpointSettings['model']['scope'] = $classScope[$position]; |
241 | 241 | |
242 | - }else{ |
|
242 | + } else{ |
|
243 | 243 | |
244 | 244 | if( !is_array($classScope) ) { |
245 | 245 | $endpointSettings['model']['scope'] = $classScope; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | if( is_array($classScope) && isset($classScope[$position]) ) { |
300 | 300 | $scope = $classScope[$position]; |
301 | 301 | |
302 | - }else{ |
|
302 | + } else{ |
|
303 | 303 | |
304 | 304 | if( !is_array($classScope) ) { |
305 | 305 | $scope = $classScope; |