| @@ 5-25 (lines=21) @@ | ||
| 2 | ||
| 3 | namespace Emarref\Jwt\Exception; |
|
| 4 | ||
| 5 | class ExpiredException extends VerificationException |
|
| 6 | { |
|
| 7 | /** |
|
| 8 | * @var \DateTime |
|
| 9 | */ |
|
| 10 | private $expiredAt; |
|
| 11 | ||
| 12 | public function __construct(\DateTime $expiredAt, $code = 0, \Exception $previous = null) { |
|
| 13 | $this->expiredAt = $expiredAt; |
|
| 14 | $message = sprintf('Token expired at "%s"', $expiredAt->format('r')); |
|
| 15 | parent::__construct($message, $code, $previous); |
|
| 16 | } |
|
| 17 | ||
| 18 | /** |
|
| 19 | * @return \DateTime |
|
| 20 | */ |
|
| 21 | public function getExpiredAt() |
|
| 22 | { |
|
| 23 | return $this->expiredAt; |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||
| @@ 5-25 (lines=21) @@ | ||
| 2 | ||
| 3 | namespace Emarref\Jwt\Exception; |
|
| 4 | ||
| 5 | class TooEarlyException extends VerificationException |
|
| 6 | { |
|
| 7 | /** |
|
| 8 | * @var \DateTime |
|
| 9 | */ |
|
| 10 | private $validFrom; |
|
| 11 | ||
| 12 | public function __construct(\DateTime $validFrom, $code = 0, \Exception $previous = null) { |
|
| 13 | $this->validFrom = $validFrom; |
|
| 14 | $message = sprintf('Token must not be processed before "%s"', $validFrom->format('r')); |
|
| 15 | parent::__construct($message, $code, $previous); |
|
| 16 | } |
|
| 17 | ||
| 18 | /** |
|
| 19 | * @return \DateTime |
|
| 20 | */ |
|
| 21 | public function getValidFrom() |
|
| 22 | { |
|
| 23 | return $this->validFrom; |
|
| 24 | } |
|
| 25 | } |
|
| 26 | ||