|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Bluz Framework Component |
|
5
|
|
|
* |
|
6
|
|
|
* @copyright Bluz PHP Team |
|
7
|
|
|
* @link https://github.com/bluzphp/framework |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
declare(strict_types=1); |
|
11
|
|
|
|
|
12
|
|
|
namespace Bluz\Proxy; |
|
13
|
|
|
|
|
14
|
|
|
use Bluz\Common\Nil; |
|
15
|
|
|
use Bluz\Http\CacheControl as Instance; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Proxy to Http\CacheControl |
|
19
|
|
|
* |
|
20
|
|
|
* Example of usage |
|
21
|
|
|
* <code> |
|
22
|
|
|
* use Bluz\Proxy\HttpCacheControl; |
|
23
|
|
|
* </code> |
|
24
|
|
|
* |
|
25
|
|
|
* @package Bluz\Proxy |
|
26
|
|
|
* @author Anton Shevchuk |
|
27
|
|
|
* |
|
28
|
|
|
* @method static Instance getInstance() |
|
29
|
|
|
* |
|
30
|
|
|
* @method static void setPrivate() |
|
31
|
|
|
* @see Instance::setPrivate() |
|
32
|
|
|
* |
|
33
|
|
|
* @method static void setPublic() |
|
34
|
|
|
* @see Instance::setPublic() |
|
35
|
|
|
* |
|
36
|
|
|
* @method static integer getMaxAge() |
|
37
|
|
|
* @see Instance::getMaxAge() |
|
38
|
|
|
* |
|
39
|
|
|
* @method static void setMaxAge($value) |
|
40
|
|
|
* @see Instance::getMaxAge() |
|
41
|
|
|
* |
|
42
|
|
|
* @method static void setSharedMaxAge($value) |
|
43
|
|
|
* @see Instance::getMaxAge() |
|
44
|
|
|
* |
|
45
|
|
|
* @method static integer getTtl() |
|
46
|
|
|
* @see Instance::getTtl() |
|
47
|
|
|
* |
|
48
|
|
|
* @method static void setTtl($seconds) |
|
49
|
|
|
* @see Instance::setTtl() |
|
50
|
|
|
* |
|
51
|
|
|
* @method static void setClientTtl($seconds) |
|
52
|
|
|
* @see Instance::setClientTtl() |
|
53
|
|
|
* |
|
54
|
|
|
* @method static string getEtag() |
|
55
|
|
|
* @see Instance::getEtag() |
|
56
|
|
|
* |
|
57
|
|
|
* @method static void setEtag($etag, $weak = false) |
|
58
|
|
|
* @see Instance::setEtag() |
|
59
|
|
|
* |
|
60
|
|
|
* @method static integer getAge() |
|
61
|
|
|
* @see Instance::getAge() |
|
62
|
|
|
* |
|
63
|
|
|
* @method static void setAge($age) |
|
64
|
|
|
* @see Instance::setAge() |
|
65
|
|
|
* |
|
66
|
|
|
* @method static \DateTime getExpires() |
|
67
|
|
|
* @see Instance::getExpires() |
|
68
|
|
|
* |
|
69
|
|
|
* @method static void setExpires($date) |
|
70
|
|
|
* @see Instance::setExpires() |
|
71
|
|
|
* |
|
72
|
|
|
* @method static \DateTime|null getLastModified() |
|
73
|
|
|
* @see Instance::getLastModified() |
|
74
|
|
|
* |
|
75
|
|
|
* @method static void setLastModified($date) |
|
76
|
|
|
* @see Instance::setLastModified() |
|
77
|
|
|
*/ |
|
78
|
|
|
final class HttpCacheControl |
|
79
|
|
|
{ |
|
80
|
|
|
use ProxyTrait; |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* Init instance |
|
84
|
|
|
* |
|
85
|
|
|
* @return Instance|Nil |
|
86
|
|
|
*/ |
|
87
|
1 |
|
private static function initInstance() |
|
|
|
|
|
|
88
|
|
|
{ |
|
89
|
1 |
|
if (PHP_SAPI === 'cli') { |
|
90
|
1 |
|
return new Nil(); |
|
91
|
|
|
} |
|
92
|
|
|
return new Instance(Response::getInstance()); |
|
93
|
|
|
} |
|
94
|
|
|
} |
|
95
|
|
|
|
This check looks for private methods that have been defined, but are not used inside the class.