1 | <?php |
||
20 | class DisplayMapFunction { |
||
21 | |||
22 | private $services; |
||
23 | |||
24 | private $renderer; |
||
25 | |||
26 | 20 | public function __construct( MappingServices $services ) { |
|
31 | |||
32 | /** |
||
33 | * @param Parser $parser |
||
34 | * @param string[] $parameters Values of the array can be named parameters ("key=value") or unnamed. |
||
35 | * They are not normalized, so can be "key = value " |
||
36 | * |
||
37 | * @return string |
||
38 | * @throws MWException |
||
39 | */ |
||
40 | 18 | public function getMapHtmlForKeyValueStrings( Parser $parser, array $parameters ): string { |
|
62 | |||
63 | /** |
||
64 | * @param Parser $parser |
||
65 | * @param string[] $parameters Key value list of parameters. Unnamed parameters have numeric keys. |
||
66 | * Both keys and values have not been normalized. |
||
67 | * |
||
68 | * @return string |
||
69 | * @throws MWException |
||
70 | */ |
||
71 | 2 | public function getMapHtmlForParameterList( Parser $parser, array $parameters ) { |
|
88 | |||
89 | 20 | private function getMapHtmlFromProcessor( Parser $parser, ParamProcessor\Processor $processor ) { |
|
90 | 20 | $params = $processor->processParameters()->getParameters(); |
|
91 | |||
92 | 20 | $this->defaultMapZoom( $params ); |
|
93 | |||
94 | 20 | $this->trackMap( $parser ); |
|
95 | |||
96 | 20 | return $this->renderer->renderMap( |
|
97 | 20 | $this->processedParametersToKeyValueArray( $params ), |
|
98 | $parser |
||
99 | ); |
||
100 | } |
||
101 | |||
102 | 20 | private function extractServiceName( array $parameters ): string { |
|
103 | 20 | $service = ( new ParameterExtractor() )->extract( |
|
104 | 20 | [ 'mappingservice', 'service' ], |
|
105 | $parameters |
||
106 | ); |
||
107 | |||
108 | 20 | return $service ?? ''; |
|
109 | } |
||
110 | |||
111 | 20 | private function processedParametersToKeyValueArray( array $params ): array { |
|
120 | |||
121 | 20 | public static function getHookDefinition( string $locationDelimiter ): \ParserHooks\HookDefinition { |
|
128 | |||
129 | 20 | private static function getParameterDefinitions( $locationDelimiter ): array { |
|
143 | |||
144 | /** |
||
145 | * @param ProcessedParam[] $parameters |
||
146 | */ |
||
147 | 20 | private function defaultMapZoom( array &$parameters ) { |
|
154 | |||
155 | 2 | private function getParameterWithValue( ProcessedParam $param, $value ) { |
|
156 | 2 | return new ProcessedParam( |
|
157 | 2 | $param->getName(), |
|
158 | $value, |
||
159 | 2 | $param->wasSetToDefault(), |
|
160 | 2 | $param->getOriginalName(), |
|
161 | 2 | $param->getOriginalValue() |
|
162 | ); |
||
163 | } |
||
164 | |||
165 | 20 | private function trackMap( Parser $parser ) { |
|
170 | |||
171 | } |
||
172 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: