| 1 | <?php |
||
| 5 | final class CacheControl |
||
| 6 | { |
||
| 7 | public const MUST_REVALIDATE = 0; |
||
| 8 | public const NO_TRANSFORM = 1; |
||
| 9 | public const NO_CACHE = 2; |
||
| 10 | public const NO_STORE = 3; |
||
| 11 | public const PUBLIC = 4; |
||
| 12 | public const PRIVATE = 5; |
||
| 13 | public const PROXY = 6; |
||
| 14 | public const MAX_AGE = 7; |
||
| 15 | public const S_MAX_AGE = 8; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var array |
||
| 19 | */ |
||
| 20 | private $modes = [ |
||
| 21 | 'must-revalidate', |
||
| 22 | 'no-transform', |
||
| 23 | 'no-cache', |
||
| 24 | 'no-store', |
||
| 25 | 'public', |
||
| 26 | 'private', |
||
| 27 | 'proxy-revalidate', |
||
| 28 | 'max-age', |
||
| 29 | 's-max-age' |
||
| 30 | ]; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @var int |
||
| 34 | */ |
||
| 35 | private $mode; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @var int |
||
| 39 | */ |
||
| 40 | private $seconds; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * CacheControl constructor. |
||
| 44 | * @param int $mode |
||
| 45 | * @param int $seconds |
||
| 46 | */ |
||
| 47 | public function __construct(int $mode, int $seconds = -1) |
||
| 60 | |||
| 61 | /** |
||
| 62 | * @return int|string |
||
| 63 | */ |
||
| 64 | public function __toString() |
||
| 74 | } |