| Total Complexity | 7 |
| Total Lines | 76 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 2 |
| 1 | <?php |
||
| 16 | final class Token implements TokenInterface |
||
| 17 | { |
||
| 18 | /** @var string */ |
||
| 19 | private $id; |
||
| 20 | |||
| 21 | /** @var \DateTimeInterface|null */ |
||
| 22 | private $expiresAt; |
||
| 23 | |||
| 24 | /** @var array */ |
||
| 25 | private $payload; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param string $id |
||
| 29 | * @param array $payload |
||
| 30 | * @param \DateTimeInterface|null $expiresAt |
||
| 31 | */ |
||
| 32 | public function __construct(string $id, array $payload, \DateTimeInterface $expiresAt = null) |
||
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @inheritDoc |
||
| 41 | */ |
||
| 42 | public function getID(): string |
||
| 43 | { |
||
| 44 | return $this->id; |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @inheritDoc |
||
| 49 | */ |
||
| 50 | public function getExpiresAt(): ?\DateTimeInterface |
||
| 53 | } |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @inheritDoc |
||
| 57 | */ |
||
| 58 | public function getPayload(): array |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Pack token data into array form. |
||
| 65 | * |
||
| 66 | * @return array |
||
| 67 | */ |
||
| 68 | public function pack(): array |
||
| 74 | ]; |
||
| 75 | } |
||
| 76 | |||
| 77 | /** |
||
| 78 | * Unpack token from serialized data. |
||
| 79 | * |
||
| 80 | * @param array $data |
||
| 81 | * @return Token |
||
| 82 | * @throws \Exception |
||
| 83 | */ |
||
| 84 | public static function unpack(array $data): Token |
||
| 94 |