1 | <?php declare(strict_types=1); |
||
9 | final class Document |
||
10 | { |
||
11 | /** |
||
12 | * @var ResponseInterface |
||
13 | */ |
||
14 | private $response; |
||
15 | |||
16 | /** |
||
17 | * @var int |
||
18 | */ |
||
19 | private $expiresAt; |
||
20 | |||
21 | 7 | private function __construct(ResponseInterface $response, int $expiresAt) |
|
26 | |||
27 | 5 | public function __toString(): string |
|
43 | |||
44 | 4 | public static function createFromString(string $json): self |
|
59 | |||
60 | 5 | public static function createFromResponse(ResponseInterface $response, int $ttl): self |
|
64 | |||
65 | /** |
||
66 | * @return ResponseInterface |
||
67 | */ |
||
68 | 6 | public function getResponse(): ResponseInterface |
|
72 | |||
73 | /** |
||
74 | * @return bool |
||
75 | */ |
||
76 | 6 | public function hasExpired(): bool |
|
80 | } |
||
81 |