1 | <?php |
||
19 | class CacheTool |
||
20 | { |
||
21 | /** |
||
22 | * @var AbstractAdapter |
||
23 | */ |
||
24 | protected $adapter; |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $proxies = []; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $functions = []; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $tempDir; |
||
40 | |||
41 | /** |
||
42 | * @var LoggerInterface |
||
43 | */ |
||
44 | protected $logger; |
||
45 | |||
46 | /** |
||
47 | * @param string $tempDir |
||
48 | * @param LoggerInterface $logger |
||
49 | */ |
||
50 | 24 | public function __construct($tempDir = null, LoggerInterface $logger = null) |
|
55 | |||
56 | /** |
||
57 | * @param AbstractAdapter $adapter |
||
58 | * @param string $tempDir |
||
59 | * @param LoggerInterface $logger |
||
60 | * @return CacheTool |
||
61 | */ |
||
62 | 20 | public static function factory(AbstractAdapter $adapter = null, $tempDir = null, LoggerInterface $logger = null) |
|
75 | |||
76 | |||
77 | /** |
||
78 | * @param AbstractAdapter $adapter |
||
79 | * @return CacheTool |
||
80 | */ |
||
81 | 19 | public function setAdapter(AbstractAdapter $adapter) |
|
91 | |||
92 | /** |
||
93 | * @return AbstractAdapter |
||
94 | */ |
||
95 | 3 | public function getAdapter() |
|
99 | |||
100 | public function getTempDir() |
||
104 | |||
105 | /** |
||
106 | * @param ProxyInterface $proxy |
||
107 | * @return CacheTool |
||
108 | */ |
||
109 | 20 | public function addProxy(ProxyInterface $proxy) |
|
120 | |||
121 | /** |
||
122 | * @return array |
||
123 | */ |
||
124 | 3 | public function getProxies() |
|
128 | |||
129 | /** |
||
130 | * @param LoggerInterface $logger |
||
131 | * @return CacheTool |
||
132 | */ |
||
133 | public function setLogger(LoggerInterface $logger) |
||
143 | |||
144 | /** |
||
145 | * @return LoggerInterface |
||
146 | */ |
||
147 | 1 | public function getLogger() |
|
151 | |||
152 | /** |
||
153 | * Calls proxy functions |
||
154 | * |
||
155 | * @param string $name |
||
156 | * @param array $arguments |
||
157 | * @return mixed |
||
158 | */ |
||
159 | 16 | public function __call($name, $arguments) |
|
168 | |||
169 | /** |
||
170 | * Initializes functions and return callable |
||
171 | * |
||
172 | * @param string $name |
||
173 | * @return callable |
||
174 | */ |
||
175 | 16 | protected function getFunction($name) |
|
197 | |||
198 | /** |
||
199 | * @param string $tempDir |
||
200 | * @return string |
||
201 | */ |
||
202 | 24 | protected function getWritableTempDir($tempDir = null) { |
|
219 | } |
||
220 |