1 | <?php |
||
2 | |||
3 | namespace Wikibase\DataModel\Services\Lookup; |
||
4 | |||
5 | use MediaWiki\Parser\Parser; |
||
0 ignored issues
–
show
|
|||
6 | use WeakMap; |
||
7 | |||
8 | /** |
||
9 | * Factory class for creating RestrictedEntityLookup instances |
||
10 | * associated with a given Parser object. Each Parser will have its |
||
11 | * own corresponding RestrictedEntityLookup instance, which enforces |
||
12 | * an access limit on entity lookups. |
||
13 | * |
||
14 | * This factory maintains a separate RestrictedEntityLookup instance |
||
15 | * for each Parser, tracking entity access counts independently. |
||
16 | * |
||
17 | * @license GPL-2.0-or-later |
||
18 | * @author Sean Leong < [email protected] > |
||
19 | */ |
||
20 | class RestrictedEntityLookupFactory { |
||
21 | |||
22 | private EntityLookup $entityLookup; |
||
23 | |||
24 | private int $entityAccessLimit; |
||
25 | |||
26 | /** |
||
27 | * @var WeakMap<Parser, EntityLookup> |
||
28 | */ |
||
29 | private WeakMap $restrictedEntityLookupMap; |
||
30 | |||
31 | public function __construct( EntityLookup $entityLookup, int $entityAccessLimit ) { |
||
32 | $this->entityLookup = $entityLookup; |
||
33 | $this->entityAccessLimit = $entityAccessLimit; |
||
34 | $this->restrictedEntityLookupMap = new WeakMap(); |
||
35 | } |
||
36 | |||
37 | public function getRestrictedEntityLookup( Parser $parser ): RestrictedEntityLookup { |
||
38 | $this->restrictedEntityLookupMap[$parser] ??= new RestrictedEntityLookup( $this->entityLookup, $this->entityAccessLimit ); |
||
39 | |||
40 | return $this->restrictedEntityLookupMap[$parser]; |
||
41 | } |
||
42 | } |
||
43 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths