1 | <?php |
||
11 | final class Ignore implements MapsObjectsByIdentity |
||
12 | { |
||
13 | private $ignoredClass; |
||
14 | private $identityMap; |
||
15 | |||
16 | private function __construct(string $ignoredClass, MapsObjectsByIdentity $identityMap) |
||
21 | |||
22 | /** |
||
23 | * Wraps the identity map with a decorator that ignores a certain class. |
||
24 | * |
||
25 | * @param string $ignoredClass The class to be ignored. |
||
26 | * @param MapsObjectsByIdentity $identityMap The identity map to wrap. |
||
27 | * @return MapsObjectsByIdentity The wrapped identity map. |
||
28 | */ |
||
29 | public static function the(string $ignoredClass, MapsObjectsByIdentity $identityMap): MapsObjectsByIdentity |
||
33 | |||
34 | /** |
||
35 | * Wraps a new identity map with decorators that ignore certain classes. |
||
36 | * |
||
37 | * @param string ...$ignoredClass The classes to be ignored. |
||
38 | * @return MapsObjectsByIdentity The wrapped identity map. |
||
39 | */ |
||
40 | public static function these(string ...$ignoredClasses): MapsObjectsByIdentity |
||
48 | |||
49 | /** @inheritdoc */ |
||
50 | public function has(string $class, string $id): bool |
||
54 | |||
55 | /** @inheritdoc */ |
||
56 | public function hasThe(object $object): bool |
||
60 | |||
61 | /** @inheritdoc */ |
||
62 | public function get(string $class, string $id): object |
||
66 | |||
67 | /** @inheritdoc */ |
||
68 | public function add(string $id, object $object): MapsObjectsByIdentity |
||
75 | |||
76 | /** @inheritdoc */ |
||
77 | public function remove(string $class, string $id): MapsObjectsByIdentity |
||
84 | |||
85 | /** @inheritdoc */ |
||
86 | public function removeThe(object $object): MapsObjectsByIdentity |
||
90 | |||
91 | /** @inheritdoc */ |
||
92 | public function removeAllObjectsOfThe(string $class): MapsObjectsByIdentity |
||
99 | |||
100 | /** @inheritdoc */ |
||
101 | public function idOf(object $object): string |
||
105 | |||
106 | private function newMap(MapsObjectsByIdentity $map): MapsObjectsByIdentity |
||
110 | } |
||
111 |