1 | <?php |
||
18 | final class Whitelist implements MapsObjectsByIdentity |
||
19 | { |
||
20 | private $allow; |
||
21 | private $map; |
||
22 | |||
23 | private function __construct(array $allow, MapsObjectsByIdentity $map) |
||
28 | |||
29 | /** |
||
30 | * Constructs a whitelist for the identity map. |
||
31 | * |
||
32 | * @param MapsObjectsByIdentity $mapped The actual identity map. |
||
33 | * @param string ...$allowedClasses The whitelisted classes. |
||
34 | * @return MapsObjectsByIdentity The wrapped identity map. |
||
35 | * @throws NoSuchObject Probably won't though. |
||
36 | */ |
||
37 | public static function forThe( |
||
48 | |||
49 | /** |
||
50 | * Whitelists the given classes in the identity map. |
||
51 | * |
||
52 | * @param string ...$classes The whitelisted classes. |
||
53 | * @return MapsObjectsByIdentity The wrapped identity map. |
||
54 | */ |
||
55 | public static function the(string ...$classes): MapsObjectsByIdentity |
||
59 | |||
60 | /** @inheritdoc */ |
||
61 | public function has(string $class, string $id): bool |
||
65 | |||
66 | /** @inheritdoc */ |
||
67 | public function hasThe(object $object): bool |
||
71 | |||
72 | /** @inheritdoc */ |
||
73 | public function get(string $class, string $id): object |
||
77 | |||
78 | /** @inheritdoc */ |
||
79 | public function idOf(object $object): string |
||
83 | |||
84 | /** @inheritdoc */ |
||
85 | public function add(string $id, object $object): MapsObjectsByIdentity |
||
92 | |||
93 | /** @inheritdoc */ |
||
94 | public function remove(string $class, string $id): MapsObjectsByIdentity |
||
98 | |||
99 | /** @inheritdoc */ |
||
100 | public function removeThe(object $object): MapsObjectsByIdentity |
||
104 | |||
105 | /** @inheritdoc */ |
||
106 | public function objects(): array |
||
110 | |||
111 | private function newMap(MapsObjectsByIdentity $map): MapsObjectsByIdentity |
||
115 | |||
116 | private static function doesNotHave( |
||
127 | } |
||
128 |