@@ -103,11 +103,11 @@  | 
                                                    ||
| 103 | 103 | return new static($quota, 1);  | 
                                                        
| 104 | 104 | }  | 
                                                        
| 105 | 105 | |
| 106 | - /**  | 
                                                        |
| 107 | - * Set quota to be used per minute  | 
                                                        |
| 108 | - * @param int $quota  | 
                                                        |
| 109 | - * @return self  | 
                                                        |
| 110 | - */  | 
                                                        |
| 106 | + /**  | 
                                                        |
| 107 | + * Set quota to be used per minute  | 
                                                        |
| 108 | + * @param int $quota  | 
                                                        |
| 109 | + * @return self  | 
                                                        |
| 110 | + */  | 
                                                        |
| 111 | 111 | public static function perMinute(int $quota): self  | 
                                                        
| 112 | 112 |      { | 
                                                        
| 113 | 113 | return new static($quota, 60);  | 
                                                        
@@ -53,8 +53,7 @@ discard block  | 
                                                    ||
| 53 | 53 | * @class Rate  | 
                                                        
| 54 | 54 | * @package Platine\Framework\Http\RateLimit  | 
                                                        
| 55 | 55 | */  | 
                                                        
| 56 | -class Rate  | 
                                                        |
| 57 | -{ | 
                                                        |
| 56 | +class Rate { | 
                                                        |
| 58 | 57 | /**  | 
                                                        
| 59 | 58 | * The rate limit quota  | 
                                                        
| 60 | 59 | * @var int  | 
                                                        
@@ -73,8 +72,7 @@ discard block  | 
                                                    ||
| 73 | 72 | * @param int $quota  | 
                                                        
| 74 | 73 | * @param int $interval  | 
                                                        
| 75 | 74 | */  | 
                                                        
| 76 | - final protected function __construct(int $quota, int $interval)  | 
                                                        |
| 77 | -    { | 
                                                        |
| 75 | +    final protected function __construct(int $quota, int $interval) { | 
                                                        |
| 78 | 76 |          if ($quota <= 0) { | 
                                                        
| 79 | 77 | throw new InvalidArgumentException(sprintf(  | 
                                                        
| 80 | 78 | 'Quota must be greater than zero, received [%d]',  | 
                                                        
@@ -40,8 +40,7 @@  | 
                                                    ||
| 40 | 40 | * @class LimitExceededException  | 
                                                        
| 41 | 41 | * @package Platine\Framework\Http\RateLimit\Exception  | 
                                                        
| 42 | 42 | */  | 
                                                        
| 43 | -class LimitExceededException extends RuntimeException  | 
                                                        |
| 44 | -{ | 
                                                        |
| 43 | +class LimitExceededException extends RuntimeException { | 
                                                        |
| 45 | 44 | /**  | 
                                                        
| 46 | 45 | * The identifier  | 
                                                        
| 47 | 46 | * @var string  | 
                                                        
@@ -51,8 +51,7 @@  | 
                                                    ||
| 51 | 51 | * @class RateLimitStorageInterface  | 
                                                        
| 52 | 52 | * @package Platine\Framework\Http\RateLimit  | 
                                                        
| 53 | 53 | */  | 
                                                        
| 54 | -interface RateLimitStorageInterface  | 
                                                        |
| 55 | -{ | 
                                                        |
| 54 | +interface RateLimitStorageInterface { | 
                                                        |
| 56 | 55 | /**  | 
                                                        
| 57 | 56 | * Store the value of the given key  | 
                                                        
| 58 | 57 | * @param string $key  | 
                                                        
@@ -54,8 +54,7 @@  | 
                                                    ||
| 54 | 54 | * @class RateLimit  | 
                                                        
| 55 | 55 | * @package Platine\Framework\Http\RateLimit  | 
                                                        
| 56 | 56 | */  | 
                                                        
| 57 | -class RateLimit  | 
                                                        |
| 58 | -{ | 
                                                        |
| 57 | +class RateLimit { | 
                                                        |
| 59 | 58 | /**  | 
                                                        
| 60 | 59 | * The storage to used  | 
                                                        
| 61 | 60 | * @var RateLimitStorageInterface  | 
                                                        
@@ -71,9 +71,9 @@  | 
                                                    ||
| 71 | 71 | $this->session = $session;  | 
                                                        
| 72 | 72 | }  | 
                                                        
| 73 | 73 | |
| 74 | - /**  | 
                                                        |
| 75 | -     * {@inheritdoc} | 
                                                        |
| 76 | - */  | 
                                                        |
| 74 | + /**  | 
                                                        |
| 75 | +         * {@inheritdoc} | 
                                                        |
| 76 | + */  | 
                                                        |
| 77 | 77 | public function set(string $key, float $value, int $ttl): bool  | 
                                                        
| 78 | 78 |      { | 
                                                        
| 79 | 79 | $this->session->set($key, [  | 
                                                        
@@ -54,8 +54,7 @@ discard block  | 
                                                    ||
| 54 | 54 | * @class SessionStorage  | 
                                                        
| 55 | 55 | * @package Platine\Framework\Http\RateLimit\Storage  | 
                                                        
| 56 | 56 | */  | 
                                                        
| 57 | -class SessionStorage implements RateLimitStorageInterface  | 
                                                        |
| 58 | -{ | 
                                                        |
| 57 | +class SessionStorage implements RateLimitStorageInterface { | 
                                                        |
| 59 | 58 | /**  | 
                                                        
| 60 | 59 | * The session instance  | 
                                                        
| 61 | 60 | * @var Session  | 
                                                        
@@ -66,8 +65,7 @@ discard block  | 
                                                    ||
| 66 | 65 | * Create new instance  | 
                                                        
| 67 | 66 | * @param Session $session  | 
                                                        
| 68 | 67 | */  | 
                                                        
| 69 | - public function __construct(Session $session)  | 
                                                        |
| 70 | -    { | 
                                                        |
| 68 | +    public function __construct(Session $session) { | 
                                                        |
| 71 | 69 | $this->session = $session;  | 
                                                        
| 72 | 70 | }  | 
                                                        
| 73 | 71 | |
@@ -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.');  |