1 | <?php |
||
35 | class InterwikiLookupAdapter implements InterwikiLookup { |
||
36 | |||
37 | /** |
||
38 | * @var SiteLookup |
||
39 | */ |
||
40 | private $siteLookup; |
||
41 | |||
42 | /** |
||
43 | * @var Interwiki[]|null associative array mapping interwiki prefixes to Interwiki objects |
||
44 | */ |
||
45 | private $interwikiMap; |
||
46 | |||
47 | function __construct( |
||
54 | |||
55 | /** |
||
56 | * See InterwikiLookup::isValidInterwiki |
||
57 | * It loads the whole interwiki map. |
||
58 | * |
||
59 | * @param string $prefix Interwiki prefix to use |
||
60 | * @return bool Whether it exists |
||
61 | */ |
||
62 | public function isValidInterwiki( $prefix ) { |
||
66 | |||
67 | /** |
||
68 | * See InterwikiLookup::fetch |
||
69 | * It loads the whole interwiki map. |
||
70 | * |
||
71 | * @param string $prefix Interwiki prefix to use |
||
72 | * @return Interwiki|null|bool |
||
73 | */ |
||
74 | public function fetch( $prefix ) { |
||
85 | |||
86 | /** |
||
87 | * See InterwikiLookup::getAllPrefixes |
||
88 | * |
||
89 | * @param string|null $local If set, limits output to local/non-local interwikis |
||
90 | * @return string[] List of prefixes |
||
91 | */ |
||
92 | public function getAllPrefixes( $local = null ) { |
||
104 | |||
105 | /** |
||
106 | * See InterwikiLookup::invalidateCache |
||
107 | * |
||
108 | * @param string $prefix |
||
109 | */ |
||
110 | public function invalidateCache( $prefix ) { |
||
122 | |||
123 | /** |
||
124 | * Load interwiki map to use as cache |
||
125 | */ |
||
126 | private function loadInterwikiMap() { |
||
135 | |||
136 | /** |
||
137 | * Get interwikiMap attribute, load if needed. |
||
138 | * |
||
139 | * @return Interwiki[] |
||
140 | */ |
||
141 | private function getInterwikiMap() { |
||
147 | |||
148 | /** |
||
149 | * Load interwikis for the given site |
||
150 | * |
||
151 | * @param Site $site |
||
152 | * @return Interwiki[] |
||
153 | */ |
||
154 | private function getSiteInterwikis( Site $site ) { |
||
175 | } |
||
176 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.