1 | <?php |
||
19 | class CacheTool |
||
20 | { |
||
21 | /** |
||
22 | * @var AbstractAdapter |
||
23 | */ |
||
24 | protected $adapter; |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $proxies = array(); |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $functions = array(); |
||
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 | public function __construct($tempDir = null, LoggerInterface $logger = null) |
||
63 | |||
64 | /** |
||
65 | * @param AbstractAdapter $adapter |
||
66 | * @param string $tempDir |
||
67 | * @param LoggerInterface $logger |
||
68 | * @return CacheTool |
||
69 | */ |
||
70 | public static function factory(AbstractAdapter $adapter = null, $tempDir = null, LoggerInterface $logger = null) |
||
84 | |||
85 | /** |
||
86 | * @param AbstractAdapter $adapter |
||
87 | * @return CacheTool |
||
88 | */ |
||
89 | public function setAdapter(AbstractAdapter $adapter) |
||
99 | |||
100 | /** |
||
101 | * @return AbstractAdapter |
||
102 | */ |
||
103 | public function getAdapter() |
||
107 | |||
108 | /** |
||
109 | * @param ProxyInterface $proxy |
||
110 | * @return CacheTool |
||
111 | */ |
||
112 | public function addProxy(ProxyInterface $proxy) |
||
123 | |||
124 | /** |
||
125 | * @return array |
||
126 | */ |
||
127 | public function getProxies() |
||
131 | |||
132 | /** |
||
133 | * @param LoggerInterface $logger |
||
134 | * @return CacheTool |
||
135 | */ |
||
136 | public function setLogger(LoggerInterface $logger) |
||
146 | |||
147 | /** |
||
148 | * @return LoggerInterface |
||
149 | */ |
||
150 | public function getLogger() |
||
154 | |||
155 | /** |
||
156 | * Calls proxy functions |
||
157 | * |
||
158 | * @param string $name |
||
159 | * @param array $arguments |
||
160 | * @return mixed |
||
161 | */ |
||
162 | public function __call($name, $arguments) |
||
170 | |||
171 | /** |
||
172 | * Initializes functions and return callable |
||
173 | * |
||
174 | * @param string $name |
||
175 | * @return callable |
||
176 | */ |
||
177 | protected function getFunction($name) |
||
199 | } |
||
200 |