1 | <?php |
||
23 | class CachingLoader extends CachingLoaderDecorator |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * @var CollectionInterface $cache |
||
28 | */ |
||
29 | protected $cache; |
||
30 | |||
31 | /** |
||
32 | * @var string $identifier |
||
33 | */ |
||
34 | protected $identifier; |
||
35 | |||
36 | /** |
||
37 | * @var ClassInterfaceCache $class_cache |
||
38 | */ |
||
39 | private $class_cache; |
||
40 | |||
41 | |||
42 | /** |
||
43 | * CachingLoader constructor. |
||
44 | * |
||
45 | * @param LoaderDecoratorInterface $loader |
||
46 | * @param CollectionInterface $cache |
||
47 | * @param ClassInterfaceCache $class_cache |
||
48 | * @param string $identifier |
||
49 | * @throws InvalidDataTypeException |
||
50 | */ |
||
51 | public function __construct( |
||
77 | |||
78 | |||
79 | |||
80 | /** |
||
81 | * @return string |
||
82 | */ |
||
83 | public function identifier() |
||
87 | |||
88 | |||
89 | |||
90 | /** |
||
91 | * @param string $identifier |
||
92 | * @throws InvalidDataTypeException |
||
93 | */ |
||
94 | private function setIdentifier($identifier) |
||
101 | |||
102 | |||
103 | /** |
||
104 | * @param FullyQualifiedName|string $fqcn |
||
105 | * @param mixed $object |
||
106 | * @return bool |
||
107 | * @throws InvalidArgumentException |
||
108 | */ |
||
109 | public function share($fqcn, $object) |
||
124 | |||
125 | |||
126 | /** |
||
127 | * @param FullyQualifiedName|string $fqcn |
||
128 | * @param array $arguments |
||
129 | * @param bool $shared |
||
130 | * @param array $interfaces |
||
131 | * @return mixed |
||
132 | */ |
||
133 | public function load($fqcn, $arguments = array(), $shared = true, array $interfaces = array()) |
||
160 | |||
161 | |||
162 | |||
163 | /** |
||
164 | * empties cache and calls reset() on loader if method exists |
||
165 | */ |
||
166 | public function reset() |
||
171 | |||
172 | |||
173 | |||
174 | /** |
||
175 | * generates an identifier for a class |
||
176 | * |
||
177 | * @param FullyQualifiedName|string $fqcn |
||
178 | * @param array $arguments |
||
179 | * @return string |
||
180 | */ |
||
181 | protected function getCacheIdentifier($fqcn, array $arguments) |
||
187 | |||
188 | |||
189 | |||
190 | /** |
||
191 | * build a string representation of a class' arguments |
||
192 | * (mostly because Closures can't be serialized) |
||
193 | * |
||
194 | * @param array $arguments |
||
195 | * @return string |
||
196 | */ |
||
197 | protected function getCacheIdentifierForArgument(array $arguments) |
||
216 | |||
217 | |||
218 | } |
||
219 | // End of file CachingLoader.php |
||
221 |