1 | <?php |
||
26 | class EditActionHookHandler implements EditPage__showStandardInputs_optionsHook { |
||
27 | |||
28 | /** |
||
29 | * @var RepoLinker |
||
30 | */ |
||
31 | private $repoLinker; |
||
32 | |||
33 | /** |
||
34 | * @var UsageLookup |
||
35 | */ |
||
36 | private $usageLookup; |
||
37 | |||
38 | /** |
||
39 | * @var LanguageFallbackLabelDescriptionLookupFactory |
||
40 | */ |
||
41 | private $labelDescriptionLookupFactory; |
||
42 | |||
43 | /** |
||
44 | * @var EntityIdParser |
||
45 | */ |
||
46 | private $idParser; |
||
47 | |||
48 | public function __construct( |
||
59 | |||
60 | public static function factory(): self { |
||
61 | $wikibaseClient = WikibaseClient::getDefaultInstance(); |
||
62 | |||
63 | $usageLookup = $wikibaseClient->getStore()->getUsageLookup(); |
||
64 | $labelDescriptionLookupFactory = new LanguageFallbackLabelDescriptionLookupFactory( |
||
65 | $wikibaseClient->getLanguageFallbackChainFactory(), |
||
66 | $wikibaseClient->getTermLookup(), |
||
67 | $wikibaseClient->getTermBuffer() |
||
68 | ); |
||
69 | $idParser = $wikibaseClient->getEntityIdParser(); |
||
70 | |||
71 | return new self( |
||
72 | $wikibaseClient->newRepoLinker(), |
||
73 | $usageLookup, |
||
74 | $labelDescriptionLookupFactory, |
||
75 | $idParser |
||
76 | ); |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * @param EditPage $editor |
||
81 | * @param OutputPage $out |
||
82 | * @param int $tabindex |
||
83 | */ |
||
84 | // phpcs:ignore MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName |
||
85 | public function onEditPage__showStandardInputs_options( $editor, $out, &$tabindex ): void { |
||
108 | |||
109 | /** |
||
110 | * @param string[][] $rowAspects |
||
111 | * @param IContextSource $context |
||
112 | * |
||
113 | * @return string HTML |
||
114 | */ |
||
115 | private function formatAspects( array $rowAspects, IContextSource $context ): string { |
||
139 | |||
140 | /** |
||
141 | * @param EntityUsage[] $usages |
||
142 | * @param IContextSource $context |
||
143 | * @return string HTML |
||
144 | */ |
||
145 | private function formatEntityUsage( array $usages, IContextSource $context ): string { |
||
182 | |||
183 | /** |
||
184 | * @param MessageLocalizer $context |
||
185 | * @return string HTML |
||
186 | */ |
||
187 | private function getHeader( MessageLocalizer $context ): string { |
||
194 | |||
195 | } |
||
196 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.