| Total Complexity | 3 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | final class Sid |
||
| 15 | { |
||
| 16 | use ValueToStringTrait; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var DateTimeImmutable |
||
| 20 | */ |
||
| 21 | private $expirationTillDateTime; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @param string $value |
||
| 25 | * @param DateTimeImmutable $expirationTillDateTime |
||
| 26 | * |
||
| 27 | * @throws InvalidSidException |
||
| 28 | */ |
||
| 29 | public function __construct(string $value, DateTimeImmutable $expirationTillDateTime) |
||
| 30 | { |
||
| 31 | $value = trim($value); |
||
| 32 | |||
| 33 | if (empty($value)) { |
||
| 34 | throw InvalidSidException::emptySid(); |
||
| 35 | } |
||
| 36 | |||
| 37 | $this->value = $value; |
||
| 38 | $this->expirationTillDateTime = $expirationTillDateTime; |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @return DateTimeImmutable |
||
| 43 | */ |
||
| 44 | public function getExpirationTillDateTime(): DateTimeImmutable |
||
| 47 | } |
||
| 48 | } |
||
| 49 |