@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * [getOptions Get the stored Responsible API options] |
163 | 163 | * @return array|null |
164 | 164 | */ |
165 | - public function getOptions():?array |
|
165 | + public function getOptions(): ?array |
|
166 | 166 | { |
167 | 167 | return $this->options; |
168 | 168 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | return; |
217 | 217 | } |
218 | 218 | if (is_null($key) || $key == '') { |
219 | - if( !is_null($response) ) { |
|
219 | + if (!is_null($response)) { |
|
220 | 220 | $this->RESPONSE['response'] = $response; |
221 | 221 | } |
222 | 222 | return; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | public function authenticate() |
259 | 259 | { |
260 | 260 | $options = $this->getOptions(); |
261 | - $route = (isset($options['route']) && !empty($options['route']) ) ? $options['route'] : ''; |
|
261 | + $route = (isset($options['route']) && !empty($options['route'])) ? $options['route'] : ''; |
|
262 | 262 | |
263 | 263 | $this->endpoints->baseApiRoot(dirname(__DIR__)); |
264 | 264 | $this->endpoints->register(); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $this->router = $router->route($route); |
270 | 270 | $endpoint = $this->endpoints->isEndpoint($router->getApi(), $router->getPath()); |
271 | 271 | |
272 | - if(isset($endpoint->model['scope'])) { |
|
272 | + if (isset($endpoint->model['scope'])) { |
|
273 | 273 | $_REQUEST['scope'] = $endpoint->model['scope']; |
274 | 274 | $this->header->setData($_REQUEST); |
275 | 275 | } |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | /** |
348 | 348 | * Check if theres a payload sent |
349 | 349 | */ |
350 | - if(isset($_REQUEST['payload'])) { |
|
350 | + if (isset($_REQUEST['payload'])) { |
|
351 | 351 | $router->setRequestBody($_REQUEST['payload']); |
352 | 352 | } |
353 | 353 | // print_r($_REQUEST); |
@@ -359,11 +359,11 @@ discard block |
||
359 | 359 | /** |
360 | 360 | * Check the access scope |
361 | 361 | */ |
362 | - if( !isset($this->router->endpoint->model['scope']) ) { |
|
362 | + if (!isset($this->router->endpoint->model['scope'])) { |
|
363 | 363 | $this->router->endpoint->model['scope'] = 'private'; |
364 | 364 | } |
365 | 365 | |
366 | - if( isset($this->header->getMethod()->data['scope']) && |
|
366 | + if (isset($this->header->getMethod()->data['scope']) && |
|
367 | 367 | ($this->header->getMethod()->data['scope'] == 'anonymous') |
368 | 368 | ) { |
369 | 369 | $this->router->endpoint->model['scope'] = 'anonymous'; |
@@ -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 |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'post' => $payload |
96 | 96 | ]; |
97 | 97 | |
98 | - if( isset($this->requestBody['payload']) ) { |
|
98 | + if (isset($this->requestBody['payload'])) { |
|
99 | 99 | array_merge($this->requestBody['payload'], $payloadPost); |
100 | 100 | return; |
101 | 101 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function getRequestBody() |
122 | 122 | { |
123 | - if( isset($this->requestBody['payload']) ) { |
|
123 | + if (isset($this->requestBody['payload'])) { |
|
124 | 124 | return $this->requestBody['payload']; |
125 | 125 | } |
126 | 126 | return $this->requestBody; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | ), |
173 | 173 | ); |
174 | 174 | |
175 | - $this->setRoutes((object)$routesArray); |
|
175 | + $this->setRoutes((object) $routesArray); |
|
176 | 176 | |
177 | 177 | return $this->getRoutes(); |
178 | 178 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $bucket->getTokenData() |
240 | 240 | ); |
241 | 241 | |
242 | - if($this->isMockTest) { |
|
242 | + if ($this->isMockTest) { |
|
243 | 243 | return; |
244 | 244 | } |
245 | 245 | |
@@ -316,12 +316,12 @@ discard block |
||
316 | 316 | */ |
317 | 317 | public function getAccount() |
318 | 318 | { |
319 | - if($this->isMockTest) { |
|
319 | + if ($this->isMockTest) { |
|
320 | 320 | $this->getMockAccount(); |
321 | 321 | return $this->mockAccount; |
322 | 322 | } |
323 | 323 | |
324 | - if (is_null($this->account)||empty($this->account)) { |
|
324 | + if (is_null($this->account) || empty($this->account)) { |
|
325 | 325 | (new exception\errorException) |
326 | 326 | ->setOptions($this->getOptions()) |
327 | 327 | ->error('UNAUTHORIZED'); |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | $mockAccount = []; |
344 | 344 | |
345 | - if(!isset($mockAccount['bucket'])) { |
|
345 | + if (!isset($mockAccount['bucket'])) { |
|
346 | 346 | $mockAccount['bucket'] = $packer->pack( |
347 | 347 | $bucket->getTokenData() |
348 | 348 | ); |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | $mockAccount['access'] = time(); |
352 | 352 | |
353 | - $this->mockAccount = (object)$mockAccount; |
|
353 | + $this->mockAccount = (object) $mockAccount; |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | |
430 | 430 | if (is_numeric($timeframe)) { |
431 | 431 | if ($timeframe < 0) { |
432 | - $timeframe = ($timeframe*-1); |
|
432 | + $timeframe = ($timeframe * -1); |
|
433 | 433 | } |
434 | 434 | self::$timeframe['CUSTOM'] = $timeframe; |
435 | 435 | $this->window = intval(self::$timeframe['CUSTOM']); |