Total Complexity | 4 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | class ResourceMetadataProvider |
||
17 | { |
||
18 | public array $metadatas = []; |
||
19 | |||
20 | public function findResourceMetadata(object $object): ResourceMetadata |
||
21 | { |
||
22 | $hash = spl_object_id($object); |
||
23 | if ($this->resourceMetadataExists($object)) { |
||
24 | return $this->metadatas[$hash]['metadata']; |
||
25 | } |
||
26 | $this->metadatas[$hash] = [ |
||
27 | 'resource' => $object, |
||
28 | 'metadata' => new ResourceMetadata(), |
||
29 | ]; |
||
30 | |||
31 | return $this->metadatas[$hash]['metadata']; |
||
32 | } |
||
33 | |||
34 | public function resourceMetadataExists(object $object): bool |
||
35 | { |
||
36 | $hash = spl_object_id($object); |
||
37 | |||
38 | return isset($this->metadatas[$hash]); |
||
39 | } |
||
40 | |||
41 | public function getMetadatas(): array |
||
44 | } |
||
45 | } |
||
46 |