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 | * @var string[] |
||
45 | */ |
||
46 | private $disabledEntityTypes = []; |
||
47 | |||
48 | /** |
||
49 | 7 | * @param EntityLookup $entityLookup |
|
50 | 7 | * @param int $entityAccessLimit |
|
51 | 1 | * |
|
52 | * @throws InvalidArgumentException |
||
53 | */ |
||
54 | 6 | public function __construct( EntityLookup $entityLookup, $entityAccessLimit ) { |
|
62 | |||
63 | /** |
||
64 | * @see EntityLookup::getEntity |
||
65 | * |
||
66 | 4 | * @param EntityId $entityId |
|
67 | 4 | * |
|
68 | * @throws EntityAccessLimitException |
||
69 | 4 | * @return EntityDocument |
|
70 | 4 | */ |
|
71 | 4 | public function getEntity( EntityId $entityId ) { |
|
94 | |||
95 | /** |
||
96 | * @see EntityLookup::hasEntity |
||
97 | * |
||
98 | * @param EntityId $entityId |
||
99 | * |
||
100 | * @return bool |
||
101 | * @throws EntityLookupException |
||
102 | */ |
||
103 | 1 | public function hasEntity( EntityId $entityId ) { |
|
106 | |||
107 | /** |
||
108 | * Returns the number of entities already loaded via this object. |
||
109 | * |
||
110 | * @since 2.0 |
||
111 | * |
||
112 | * @return int |
||
113 | */ |
||
114 | public function getEntityAccessCount() { |
||
117 | 1 | ||
118 | /** |
||
119 | 1 | * Resets the number and list of entities loaded via this object. |
|
120 | * |
||
121 | * @since 3.4 |
||
122 | */ |
||
123 | public function reset() { |
||
127 | |||
128 | /** |
||
129 | * Whether an entity has been accessed before via this RestrictedEntityLookup. |
||
130 | * |
||
131 | * @since 2.0 |
||
132 | * |
||
133 | * @param EntityId $entityId |
||
134 | * |
||
135 | * @return bool |
||
136 | */ |
||
137 | public function entityHasBeenAccessed( EntityId $entityId ) { |
||
142 | |||
143 | /** |
||
144 | * @param string[] $disabledEntityTypes |
||
145 | */ |
||
146 | public function setDisabledEntityTypes( array $disabledEntityTypes ) { |
||
149 | |||
150 | } |
||
151 |