1 | <?php |
||
29 | class MetaCache |
||
30 | { |
||
31 | |||
32 | private $_metaClass = null; |
||
33 | private $_component = null; |
||
34 | |||
35 | /** |
||
36 | * Options |
||
37 | * @var string |
||
38 | */ |
||
39 | private $_instanceId = null; |
||
40 | |||
41 | /** |
||
42 | * Addendum runtime path |
||
43 | * @var string |
||
44 | */ |
||
45 | private $_path = ''; |
||
46 | |||
47 | /** |
||
48 | * |
||
49 | * @var NsCache |
||
50 | */ |
||
51 | private $_nsCache = null; |
||
52 | |||
53 | /** |
||
54 | * Runtime path |
||
55 | * @var string |
||
56 | */ |
||
57 | private static $_runtimePath = null; |
||
58 | |||
59 | /** |
||
60 | * Local cacheq |
||
61 | * @var type |
||
62 | */ |
||
63 | private static $_cache = []; |
||
64 | |||
65 | 3 | public function __construct($metaClass = null, AnnotatedInterface $component = null, MetaOptions $options = null) |
|
84 | |||
85 | 27 | public function setComponent(AnnotatedInterface $component = null) |
|
89 | |||
90 | 27 | public function setOptions(MetaOptions $options = null) |
|
94 | |||
95 | 27 | public function prepare() |
|
96 | { |
||
97 | 27 | if (!file_exists($this->_path)) |
|
98 | 27 | { |
|
99 | 2 | if (!file_exists(self::$_runtimePath)) |
|
100 | 2 | { |
|
101 | |||
102 | 1 | if (is_writable(dirname(self::$_runtimePath))) |
|
103 | 1 | { |
|
104 | 1 | mkdir(self::$_runtimePath, 0777, true); |
|
105 | 1 | } |
|
106 | 1 | if (!is_writable(self::$_runtimePath)) |
|
107 | 1 | { |
|
108 | throw new RuntimeException(sprintf("Runtime path `%s` must exists and be writable", self:: $_runtimePath)); |
||
|
|||
109 | } |
||
110 | 1 | } |
|
111 | 2 | if (is_writable(self::$_runtimePath)) |
|
112 | 2 | { |
|
113 | 2 | mkdir($this->_path, 0777, true); |
|
114 | 2 | } |
|
115 | 2 | if (!is_writable($this->_path)) |
|
116 | 2 | { |
|
117 | throw new RuntimeException(sprintf("Addendum runtime path `%s` must exists and be writable", $this->_path)); |
||
118 | } |
||
119 | 2 | } |
|
120 | 27 | if (!file_exists(dirname($this->_getFilename()))) |
|
121 | 27 | { |
|
122 | 2 | mkdir(dirname($this->_getFilename()), 0777, true); |
|
123 | 2 | } |
|
124 | 27 | } |
|
125 | |||
126 | 27 | public function get() |
|
151 | |||
152 | 19 | public function set(Meta $meta) |
|
165 | |||
166 | public function remove() |
||
176 | |||
177 | /** |
||
178 | * Clear entire cache |
||
179 | * @return boolean |
||
180 | */ |
||
181 | 3 | public function clear() |
|
185 | |||
186 | 2 | private function _clearCurrent() |
|
190 | |||
191 | 3 | private function _clear($path) |
|
203 | |||
204 | 29 | private function _getFilename() |
|
208 | |||
209 | 29 | private function _classToFile($className) |
|
213 | |||
214 | } |
||
215 |
This check looks for references to static members where there are spaces between the name of the type and the actual member.
An example:
will actually work, but is not very readable.