| 1 | <?php  | 
            ||
| 9 | class Status  | 
            ||
| 10 | { | 
            ||
| 11 | /** @var string */  | 
            ||
| 12 | protected $identifier;  | 
            ||
| 13 | |||
| 14 | /** @var int */  | 
            ||
| 15 | protected $current;  | 
            ||
| 16 | |||
| 17 | /** @var Rate */  | 
            ||
| 18 | protected $rate;  | 
            ||
| 19 | |||
| 20 | /** @var DateTimeImmutable */  | 
            ||
| 21 | protected $resetAt;  | 
            ||
| 22 | |||
| 23 | 10 | final protected function __construct(string $identifier, int $current, Rate $rate, DateTimeImmutable $resetAt)  | 
            |
| 30 | |||
| 31 | 10 | public static function from(string $identifier, int $current, Rate $rate, DateTimeImmutable $resetAt)  | 
            |
| 35 | |||
| 36 | public function getIdentifier(): string  | 
            ||
| 40 | |||
| 41 | 2 | public function getCurrent(): int  | 
            |
| 45 | |||
| 46 | 10 | public function getLimit(): int  | 
            |
| 47 |     { | 
            ||
| 48 | 10 | return $this->rate->getOperations();  | 
            |
| 49 | }  | 
            ||
| 50 | |||
| 51 | 4 | public function getResetAt(): DateTimeImmutable  | 
            |
| 55 | |||
| 56 | 10 | public function limitExceeded(): bool  | 
            |
| 57 |     { | 
            ||
| 58 | 10 | return $this->current > $this->getLimit();  | 
            |
| 59 | }  | 
            ||
| 60 | |||
| 61 | 10 | public function getRemainingAttempts(): int  | 
            |
| 65 | }  | 
            ||
| 66 |