@@ -53,8 +53,7 @@ |
||
| 53 | 53 | * @class InMemoryStorage |
| 54 | 54 | * @package Platine\Framework\Http\RateLimit\Storage |
| 55 | 55 | */ |
| 56 | -class InMemoryStorage implements RateLimitStorageInterface |
|
| 57 | -{ |
|
| 56 | +class InMemoryStorage implements RateLimitStorageInterface { |
|
| 58 | 57 | /** |
| 59 | 58 | * The data store |
| 60 | 59 | * @var array<string, mixed> |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | class ApcuStorage implements RateLimitStorageInterface |
| 58 | 58 | { |
| 59 | - /** |
|
| 59 | + /** |
|
| 60 | 60 | * Create new instance |
| 61 | 61 | */ |
| 62 | 62 | public function __construct() |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * {@inheritdoc} |
|
| 72 | - */ |
|
| 70 | + /** |
|
| 71 | + * {@inheritdoc} |
|
| 72 | + */ |
|
| 73 | 73 | public function set(string $key, float $value, int $ttl): bool |
| 74 | 74 | { |
| 75 | 75 | return apcu_store($key, $value, $ttl); |
@@ -54,13 +54,11 @@ |
||
| 54 | 54 | * @class ApcuStorage |
| 55 | 55 | * @package Platine\Framework\Http\RateLimit\Storage |
| 56 | 56 | */ |
| 57 | -class ApcuStorage implements RateLimitStorageInterface |
|
| 58 | -{ |
|
| 57 | +class ApcuStorage implements RateLimitStorageInterface { |
|
| 59 | 58 | /** |
| 60 | 59 | * Create new instance |
| 61 | 60 | */ |
| 62 | - public function __construct() |
|
| 63 | - { |
|
| 61 | + public function __construct() { |
|
| 64 | 62 | if ((!extension_loaded('apcu')) || !((bool) ini_get('apc.enabled'))) { |
| 65 | 63 | throw new RuntimeException('The rate limit storage for APCu driver is not available.' |
| 66 | 64 | . ' Check if APCu extension is loaded and enabled.'); |
@@ -37,8 +37,7 @@ |
||
| 37 | 37 | * @class HttpTooManyRequestsException |
| 38 | 38 | * @package Platine\Framework\Http\Exception |
| 39 | 39 | */ |
| 40 | -class HttpTooManyRequestsException extends HttpSpecialException |
|
| 41 | -{ |
|
| 40 | +class HttpTooManyRequestsException extends HttpSpecialException { |
|
| 42 | 41 | /** |
| 43 | 42 | * |
| 44 | 43 | * @var int |
@@ -138,8 +138,8 @@ |
||
| 138 | 138 | ); |
| 139 | 139 | |
| 140 | 140 | $httpException->setTitle('Service Unavailable') |
| 141 | - ->setDescription($message) |
|
| 142 | - ->setHeaders($this->getHeaders($data)); |
|
| 141 | + ->setDescription($message) |
|
| 142 | + ->setHeaders($this->getHeaders($data)); |
|
| 143 | 143 | |
| 144 | 144 | throw $httpException; |
| 145 | 145 | } |
@@ -71,8 +71,7 @@ |
||
| 71 | 71 | * @package Platine\Framework\Http\Middleware |
| 72 | 72 | * @template T |
| 73 | 73 | */ |
| 74 | -class MaintenanceMiddleware implements MiddlewareInterface |
|
| 75 | -{ |
|
| 74 | +class MaintenanceMiddleware implements MiddlewareInterface { |
|
| 76 | 75 | /** |
| 77 | 76 | * Create new instance |
| 78 | 77 | * @param Config<T> $config |
@@ -55,8 +55,7 @@ |
||
| 55 | 55 | * @package Platine\Framework\Config |
| 56 | 56 | * @template TDbConfigurationEntity as Entity |
| 57 | 57 | */ |
| 58 | -interface DatabaseConfigLoaderInterface |
|
| 59 | -{ |
|
| 58 | +interface DatabaseConfigLoaderInterface { |
|
| 60 | 59 | /** |
| 61 | 60 | * Load the configuration group for the given environment with custom filters |
| 62 | 61 | * @param string $environment the name of the environment |
@@ -51,8 +51,7 @@ |
||
| 51 | 51 | * @class UserStatus |
| 52 | 52 | * @package Platine\Framework\Auth\Enum |
| 53 | 53 | */ |
| 54 | -class UserStatus |
|
| 55 | -{ |
|
| 54 | +class UserStatus { |
|
| 56 | 55 | public const ACTIVE = 'A'; |
| 57 | 56 | public const LOCKED = 'D'; |
| 58 | 57 | } |
@@ -64,17 +64,17 @@ discard block |
||
| 64 | 64 | '\'', '"', '&', '$', '#', |
| 65 | 65 | '{', '}', '[', ']', '=', |
| 66 | 66 | ';', '?', '%20', '%22', |
| 67 | - '%3c', // < |
|
| 68 | - '%253c', // < |
|
| 69 | - '%3e', // > |
|
| 70 | - '%0e', // > |
|
| 71 | - '%28', // ( |
|
| 72 | - '%29', // ) |
|
| 73 | - '%2528', // ( |
|
| 74 | - '%26', // & |
|
| 75 | - '%24', // $ |
|
| 76 | - '%3f', // ? |
|
| 77 | - '%3b', // ; |
|
| 67 | + '%3c', // < |
|
| 68 | + '%253c', // < |
|
| 69 | + '%3e', // > |
|
| 70 | + '%0e', // > |
|
| 71 | + '%28', // ( |
|
| 72 | + '%29', // ) |
|
| 73 | + '%2528', // ( |
|
| 74 | + '%26', // & |
|
| 75 | + '%24', // $ |
|
| 76 | + '%3f', // ? |
|
| 77 | + '%3b', // ; |
|
| 78 | 78 | '%3d' // = |
| 79 | 79 | ]; |
| 80 | 80 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | return $str; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - if ($str === '' || $str === null || is_bool($str) || ! $str || is_numeric($str)) { |
|
| 151 | + if ($str === '' || $str === null || is_bool($str) || !$str || is_numeric($str)) { |
|
| 152 | 152 | return $str; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | |
| 482 | 482 | $flag = ENT_COMPAT | ENT_HTML5; |
| 483 | 483 | |
| 484 | - if (! isset($entities)) { |
|
| 484 | + if (!isset($entities)) { |
|
| 485 | 485 | $entities = array_map( |
| 486 | 486 | 'strtolower', |
| 487 | 487 | get_html_translation_table(HTML_ENTITIES, $flag, $charset) |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | static $naughtyTags = [ |
| 558 | 558 | 'alert', 'area', 'prompt', 'confirm', 'applet', 'audio', 'basefont', |
| 559 | 559 | 'base', 'behavior', 'bgsound', 'blink', 'body', 'embed', 'expression', |
| 560 | - 'form', 'frameset', 'frame', 'head', 'html', 'ilayer','iframe', 'input', |
|
| 560 | + 'form', 'frameset', 'frame', 'head', 'html', 'ilayer', 'iframe', 'input', |
|
| 561 | 561 | 'button', 'select', 'isindex', 'layer', 'link', 'meta', 'keygen', 'object', |
| 562 | 562 | 'plaintext', 'style', 'script', 'textarea', 'title', 'math', 'video', 'svg', |
| 563 | 563 | 'xml', 'xss' |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | ); |
| 602 | 602 | $attribute = []; |
| 603 | 603 | if ( |
| 604 | - ! preg_match( |
|
| 604 | + !preg_match( |
|
| 605 | 605 | $attributesPattern, |
| 606 | 606 | $matches['attributes'], |
| 607 | 607 | $attribute, |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | $attributes[] = $attribute[0][0]; |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | - $matches['attributes'] = (string) substr( |
|
| 626 | + $matches['attributes'] = (string) substr( |
|
| 627 | 627 | $matches['attributes'], |
| 628 | 628 | $attribute[0][1] + strlen($attribute[0][0]) |
| 629 | 629 | ); |
@@ -774,9 +774,9 @@ discard block |
||
| 774 | 774 | */ |
| 775 | 775 | |
| 776 | 776 | if ($urlEncode) { |
| 777 | - $nonDisplayables[] = '/%0[0-8bcef]/i'; // URL encoded 00-08, 11, 12, 14, 15 |
|
| 778 | - $nonDisplayables[] = '/%1[0-9a-f]/i'; // URL encoded 16-31 |
|
| 779 | - $nonDisplayables[] = '/%7f/i'; // URL encoded 127 |
|
| 777 | + $nonDisplayables[] = '/%0[0-8bcef]/i'; // URL encoded 00-08, 11, 12, 14, 15 |
|
| 778 | + $nonDisplayables[] = '/%1[0-9a-f]/i'; // URL encoded 16-31 |
|
| 779 | + $nonDisplayables[] = '/%7f/i'; // URL encoded 127 |
|
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | $nonDisplayables[] = '/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S'; // 00-08, 11, 12, 14-31, 127 |
@@ -133,11 +133,11 @@ |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
| 136 | - * The main function to clean input |
|
| 137 | - * @param mixed $str |
|
| 138 | - * @param bool $isImage |
|
| 139 | - * @return mixed |
|
| 140 | - */ |
|
| 136 | + * The main function to clean input |
|
| 137 | + * @param mixed $str |
|
| 138 | + * @param bool $isImage |
|
| 139 | + * @return mixed |
|
| 140 | + */ |
|
| 141 | 141 | public function clean(mixed $str, bool $isImage = false): mixed |
| 142 | 142 | { |
| 143 | 143 | if (is_array($str)) { |
@@ -53,8 +53,7 @@ discard block |
||
| 53 | 53 | * @class InputClean |
| 54 | 54 | * @package Platine\Framework\Http |
| 55 | 55 | */ |
| 56 | -class InputClean |
|
| 57 | -{ |
|
| 56 | +class InputClean { |
|
| 58 | 57 | /** |
| 59 | 58 | * The list of invalid filename chars |
| 60 | 59 | * @var array<string> |
@@ -127,8 +126,7 @@ discard block |
||
| 127 | 126 | * Create new instance |
| 128 | 127 | * @param string $charset |
| 129 | 128 | */ |
| 130 | - public function __construct(string $charset = 'UTF-8') |
|
| 131 | - { |
|
| 129 | + public function __construct(string $charset = 'UTF-8') { |
|
| 132 | 130 | $this->charset = $charset; |
| 133 | 131 | } |
| 134 | 132 | |
@@ -52,8 +52,7 @@ discard block |
||
| 52 | 52 | * @class TOTP |
| 53 | 53 | * @package Platine\Framework\Security\OTP |
| 54 | 54 | */ |
| 55 | -class TOTP |
|
| 56 | -{ |
|
| 55 | +class TOTP { |
|
| 57 | 56 | /** |
| 58 | 57 | * The length of the secret |
| 59 | 58 | * @var int |
@@ -82,8 +81,7 @@ discard block |
||
| 82 | 81 | * Create new instance |
| 83 | 82 | * @param string|null $secret |
| 84 | 83 | */ |
| 85 | - public function __construct(?string $secret = null) |
|
| 86 | - { |
|
| 84 | + public function __construct(?string $secret = null) { |
|
| 87 | 85 | if ($secret === null) { |
| 88 | 86 | $secret = $this->generateSecret(); |
| 89 | 87 | } |
@@ -120,7 +120,7 @@ |
||
| 120 | 120 | */ |
| 121 | 121 | protected function shouldBeProcessed(ServerRequestInterface $request): bool |
| 122 | 122 | { |
| 123 | - //If no route has been match no need check |
|
| 123 | + //If no route has been match no need check |
|
| 124 | 124 | /** @var Route|null $route */ |
| 125 | 125 | $route = $request->getAttribute(Route::class); |
| 126 | 126 | if ($route === null) { |
@@ -49,8 +49,7 @@ |
||
| 49 | 49 | * @package Platine\Framework\OAuth2\Middleware |
| 50 | 50 | * @template T |
| 51 | 51 | */ |
| 52 | -class OAuthResourceMiddleware implements MiddlewareInterface |
|
| 53 | -{ |
|
| 52 | +class OAuthResourceMiddleware implements MiddlewareInterface { |
|
| 54 | 53 | /** |
| 55 | 54 | * The scope list |
| 56 | 55 | * @var array<string> |