1 | <?php |
||
21 | class RestrictedEntityLookup implements EntityLookup { |
||
22 | |||
23 | /** |
||
24 | * @var EntityLookup |
||
25 | */ |
||
26 | private $entityLookup; |
||
27 | |||
28 | /** |
||
29 | * @var int |
||
30 | */ |
||
31 | private $entityAccessLimit; |
||
32 | |||
33 | /** |
||
34 | * @var bool[] Entity id serialization => bool |
||
35 | */ |
||
36 | private $entitiesAccessed = []; |
||
37 | |||
38 | /** |
||
39 | * @var int |
||
40 | */ |
||
41 | private $entityAccessCount = 0; |
||
42 | |||
43 | /** |
||
44 | * @param EntityLookup $entityLookup |
||
45 | * @param int $entityAccessLimit |
||
46 | * |
||
47 | * @throws InvalidArgumentException |
||
48 | */ |
||
49 | 7 | public function __construct( EntityLookup $entityLookup, $entityAccessLimit ) { |
|
57 | |||
58 | /** |
||
59 | * @see EntityLookup::getEntity |
||
60 | * |
||
61 | * @param EntityId $entityId |
||
62 | * |
||
63 | * @throws EntityAccessLimitException |
||
64 | * @return EntityDocument |
||
65 | */ |
||
66 | 4 | public function getEntity( EntityId $entityId ) { |
|
83 | |||
84 | /** |
||
85 | * @see EntityLookup::hasEntity |
||
86 | * |
||
87 | * @param EntityId $entityId |
||
88 | * |
||
89 | * @return bool |
||
90 | * @throws EntityLookupException |
||
91 | */ |
||
92 | 1 | public function hasEntity( EntityId $entityId ) { |
|
95 | |||
96 | /** |
||
97 | * Returns the number of entities already loaded via this object. |
||
98 | * |
||
99 | * @since 2.0 |
||
100 | * |
||
101 | * @return int |
||
102 | */ |
||
103 | 1 | public function getEntityAccessCount() { |
|
106 | |||
107 | /** |
||
108 | * Resets the number and list of entities loaded via this object. |
||
109 | * |
||
110 | * @since 3.4 |
||
111 | */ |
||
112 | public function reset() { |
||
116 | 1 | ||
117 | 1 | /** |
|
118 | * Whether an entity has been accessed before via this RestrictedEntityLookup. |
||
119 | 1 | * |
|
120 | * @since 2.0 |
||
121 | * |
||
122 | * @param EntityId $entityId |
||
123 | * |
||
124 | * @return bool |
||
125 | */ |
||
126 | public function entityHasBeenAccessed( EntityId $entityId ) { |
||
131 | |||
132 | } |
||
133 |