1 | <?php |
||
14 | class RequestCacheControl extends CacheControl |
||
15 | { |
||
16 | /** |
||
17 | * {@inheritdoc} |
||
18 | */ |
||
19 | protected static $directiveMethods = [ |
||
20 | 'max-stale' => 'withMaxStale', |
||
21 | 'min-fresh' => 'withMinFresh', |
||
22 | 'only-if-cached' => 'withOnlyIfCached', |
||
23 | ]; |
||
24 | |||
25 | /** |
||
26 | * Create a new Request Cache-Control object from a header string. |
||
27 | * |
||
28 | * @param string $string |
||
29 | * @return static |
||
30 | */ |
||
31 | 1 | public static function fromString($string) |
|
35 | |||
36 | /** |
||
37 | * Set how many seconds a stale representation is acceptable. |
||
38 | * |
||
39 | * @param int $seconds |
||
40 | * @return static |
||
41 | */ |
||
42 | 1 | public function withMaxStale($seconds) |
|
46 | |||
47 | /** |
||
48 | * @return int|null |
||
49 | */ |
||
50 | 1 | public function getMaxStale() |
|
54 | |||
55 | /** |
||
56 | * Set how many seconds the representation should still be fresh. |
||
57 | * |
||
58 | * @param int $seconds |
||
59 | * @return static |
||
60 | */ |
||
61 | 1 | public function withMinFresh($seconds) |
|
65 | |||
66 | /** |
||
67 | * @return int|null |
||
68 | */ |
||
69 | 1 | public function getMinFresh() |
|
73 | |||
74 | /** |
||
75 | * Set whether only a stored response should be returned. |
||
76 | * |
||
77 | * @param bool $flag |
||
78 | * @return static |
||
79 | */ |
||
80 | 1 | public function withOnlyIfCached($flag = true) |
|
84 | |||
85 | /** |
||
86 | * @return bool |
||
87 | */ |
||
88 | 1 | public function hasOnlyIfCached() |
|
92 | } |
||
93 |