@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare( strict_types = 1 ); |
|
| 3 | +declare(strict_types=1); |
|
| 4 | 4 | |
| 5 | 5 | namespace WikibaseQuality\ConstraintReport\ConstraintCheck\Message; |
| 6 | 6 | |
@@ -59,17 +59,17 @@ discard block |
||
| 59 | 59 | $this->maxListLength = $maxListLength; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public function render( ViolationMessage $violationMessage ): string { |
|
| 62 | + public function render(ViolationMessage $violationMessage): string { |
|
| 63 | 63 | $messageKey = $violationMessage->getMessageKey(); |
| 64 | - $paramsLists = [ [] ]; |
|
| 65 | - foreach ( $violationMessage->getArguments() as $argument ) { |
|
| 66 | - $params = $this->renderArgument( $argument ); |
|
| 64 | + $paramsLists = [[]]; |
|
| 65 | + foreach ($violationMessage->getArguments() as $argument) { |
|
| 66 | + $params = $this->renderArgument($argument); |
|
| 67 | 67 | $paramsLists[] = $params; |
| 68 | 68 | } |
| 69 | - $allParams = call_user_func_array( 'array_merge', $paramsLists ); |
|
| 69 | + $allParams = call_user_func_array('array_merge', $paramsLists); |
|
| 70 | 70 | return $this->messageLocalizer |
| 71 | - ->msg( $messageKey ) |
|
| 72 | - ->params( $allParams ) |
|
| 71 | + ->msg($messageKey) |
|
| 72 | + ->params($allParams) |
|
| 73 | 73 | ->escaped(); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -78,13 +78,13 @@ discard block |
||
| 78 | 78 | * @param string|null $role one of the Role::* constants |
| 79 | 79 | * @return string HTML |
| 80 | 80 | */ |
| 81 | - protected function addRole( string $value, ?string $role ): string { |
|
| 82 | - if ( $role === null ) { |
|
| 81 | + protected function addRole(string $value, ?string $role): string { |
|
| 82 | + if ($role === null) { |
|
| 83 | 83 | return $value; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - return '<span class="wbqc-role wbqc-role-' . htmlspecialchars( $role ) . '">' . |
|
| 87 | - $value . |
|
| 86 | + return '<span class="wbqc-role wbqc-role-'.htmlspecialchars($role).'">'. |
|
| 87 | + $value. |
|
| 88 | 88 | '</span>'; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -92,15 +92,15 @@ discard block |
||
| 92 | 92 | * @param string $key message key |
| 93 | 93 | * @return string HTML |
| 94 | 94 | */ |
| 95 | - protected function msgEscaped( string $key ): string { |
|
| 96 | - return $this->messageLocalizer->msg( $key )->escaped(); |
|
| 95 | + protected function msgEscaped(string $key): string { |
|
| 96 | + return $this->messageLocalizer->msg($key)->escaped(); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * @param array $argument |
| 101 | 101 | * @return array[] params (for Message::params) |
| 102 | 102 | */ |
| 103 | - protected function renderArgument( array $argument ): array { |
|
| 103 | + protected function renderArgument(array $argument): array { |
|
| 104 | 104 | $methods = [ |
| 105 | 105 | ViolationMessage::TYPE_ENTITY_ID => 'renderEntityId', |
| 106 | 106 | ViolationMessage::TYPE_ENTITY_ID_LIST => 'renderEntityIdList', |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | $value = $argument['value']; |
| 122 | 122 | $role = $argument['role']; |
| 123 | 123 | |
| 124 | - if ( array_key_exists( $type, $methods ) ) { |
|
| 124 | + if (array_key_exists($type, $methods)) { |
|
| 125 | 125 | $method = $methods[$type]; |
| 126 | - $params = $this->$method( $value, $role ); |
|
| 126 | + $params = $this->$method($value, $role); |
|
| 127 | 127 | } else { |
| 128 | 128 | throw new InvalidArgumentException( |
| 129 | - 'Unknown ViolationMessage argument type ' . $type . '!' |
|
| 129 | + 'Unknown ViolationMessage argument type '.$type.'!' |
|
| 130 | 130 | ); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -140,36 +140,36 @@ discard block |
||
| 140 | 140 | * and return a single-element array with a raw message param (i. e. [ Message::rawParam( … ) ]) |
| 141 | 141 | * @return array[] list of parameters as accepted by Message::params() |
| 142 | 142 | */ |
| 143 | - private function renderList( array $list, ?string $role, callable $render ): array { |
|
| 144 | - if ( $list === [] ) { |
|
| 143 | + private function renderList(array $list, ?string $role, callable $render): array { |
|
| 144 | + if ($list === []) { |
|
| 145 | 145 | return [ |
| 146 | - Message::numParam( 0 ), |
|
| 147 | - Message::rawParam( '<ul></ul>' ), |
|
| 146 | + Message::numParam(0), |
|
| 147 | + Message::rawParam('<ul></ul>'), |
|
| 148 | 148 | ]; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - if ( count( $list ) > $this->maxListLength ) { |
|
| 152 | - $list = array_slice( $list, 0, $this->maxListLength ); |
|
| 151 | + if (count($list) > $this->maxListLength) { |
|
| 152 | + $list = array_slice($list, 0, $this->maxListLength); |
|
| 153 | 153 | $truncated = true; |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | $renderedParamsLists = array_map( |
| 157 | 157 | $render, |
| 158 | 158 | $list, |
| 159 | - array_fill( 0, count( $list ), $role ) |
|
| 159 | + array_fill(0, count($list), $role) |
|
| 160 | 160 | ); |
| 161 | - $renderedParams = array_column( $renderedParamsLists, 0 ); |
|
| 162 | - $renderedElements = array_column( $renderedParams, 'raw' ); |
|
| 163 | - if ( isset( $truncated ) ) { |
|
| 164 | - $renderedElements[] = $this->msgEscaped( 'ellipsis' ); |
|
| 161 | + $renderedParams = array_column($renderedParamsLists, 0); |
|
| 162 | + $renderedElements = array_column($renderedParams, 'raw'); |
|
| 163 | + if (isset($truncated)) { |
|
| 164 | + $renderedElements[] = $this->msgEscaped('ellipsis'); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | return array_merge( |
| 168 | 168 | [ |
| 169 | - Message::numParam( count( $list ) ), |
|
| 169 | + Message::numParam(count($list)), |
|
| 170 | 170 | Message::rawParam( |
| 171 | - '<ul><li>' . |
|
| 172 | - implode( '</li><li>', $renderedElements ) . |
|
| 171 | + '<ul><li>'. |
|
| 172 | + implode('</li><li>', $renderedElements). |
|
| 173 | 173 | '</li></ul>' |
| 174 | 174 | ), |
| 175 | 175 | ], |
@@ -182,11 +182,11 @@ discard block |
||
| 182 | 182 | * @param string|null $role one of the Role::* constants |
| 183 | 183 | * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ]) |
| 184 | 184 | */ |
| 185 | - private function renderEntityId( EntityId $entityId, ?string $role ): array { |
|
| 186 | - return [ Message::rawParam( $this->addRole( |
|
| 187 | - $this->entityIdFormatter->formatEntityId( $entityId ), |
|
| 185 | + private function renderEntityId(EntityId $entityId, ?string $role): array { |
|
| 186 | + return [Message::rawParam($this->addRole( |
|
| 187 | + $this->entityIdFormatter->formatEntityId($entityId), |
|
| 188 | 188 | $role |
| 189 | - ) ) ]; |
|
| 189 | + ))]; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | /** |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | * @param string|null $role one of the Role::* constants |
| 195 | 195 | * @return array[] list of parameters as accepted by Message::params() |
| 196 | 196 | */ |
| 197 | - private function renderEntityIdList( array $entityIdList, ?string $role ): array { |
|
| 198 | - return $this->renderList( $entityIdList, $role, [ $this, 'renderEntityId' ] ); |
|
| 197 | + private function renderEntityIdList(array $entityIdList, ?string $role): array { |
|
| 198 | + return $this->renderList($entityIdList, $role, [$this, 'renderEntityId']); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -203,24 +203,24 @@ discard block |
||
| 203 | 203 | * @param string|null $role one of the Role::* constants |
| 204 | 204 | * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ]) |
| 205 | 205 | */ |
| 206 | - private function renderItemIdSnakValue( ItemIdSnakValue $value, ?string $role ): array { |
|
| 207 | - switch ( true ) { |
|
| 206 | + private function renderItemIdSnakValue(ItemIdSnakValue $value, ?string $role): array { |
|
| 207 | + switch (true) { |
|
| 208 | 208 | case $value->isValue(): |
| 209 | - return $this->renderEntityId( $value->getItemId(), $role ); |
|
| 209 | + return $this->renderEntityId($value->getItemId(), $role); |
|
| 210 | 210 | case $value->isSomeValue(): |
| 211 | - return [ Message::rawParam( $this->addRole( |
|
| 212 | - '<span class="wikibase-snakview-variation-somevaluesnak">' . |
|
| 213 | - $this->msgEscaped( 'wikibase-snakview-snaktypeselector-somevalue' ) . |
|
| 211 | + return [Message::rawParam($this->addRole( |
|
| 212 | + '<span class="wikibase-snakview-variation-somevaluesnak">'. |
|
| 213 | + $this->msgEscaped('wikibase-snakview-snaktypeselector-somevalue'). |
|
| 214 | 214 | '</span>', |
| 215 | 215 | $role |
| 216 | - ) ) ]; |
|
| 216 | + ))]; |
|
| 217 | 217 | case $value->isNoValue(): |
| 218 | - return [ Message::rawParam( $this->addRole( |
|
| 219 | - '<span class="wikibase-snakview-variation-novaluesnak">' . |
|
| 220 | - $this->msgEscaped( 'wikibase-snakview-snaktypeselector-novalue' ) . |
|
| 218 | + return [Message::rawParam($this->addRole( |
|
| 219 | + '<span class="wikibase-snakview-variation-novaluesnak">'. |
|
| 220 | + $this->msgEscaped('wikibase-snakview-snaktypeselector-novalue'). |
|
| 221 | 221 | '</span>', |
| 222 | 222 | $role |
| 223 | - ) ) ]; |
|
| 223 | + ))]; |
|
| 224 | 224 | default: |
| 225 | 225 | // @codeCoverageIgnoreStart |
| 226 | 226 | throw new LogicException( |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | * @param string|null $role one of the Role::* constants |
| 236 | 236 | * @return array[] list of parameters as accepted by Message::params() |
| 237 | 237 | */ |
| 238 | - private function renderItemIdSnakValueList( array $valueList, ?string $role ): array { |
|
| 239 | - return $this->renderList( $valueList, $role, [ $this, 'renderItemIdSnakValue' ] ); |
|
| 238 | + private function renderItemIdSnakValueList(array $valueList, ?string $role): array { |
|
| 239 | + return $this->renderList($valueList, $role, [$this, 'renderItemIdSnakValue']); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
@@ -244,11 +244,11 @@ discard block |
||
| 244 | 244 | * @param string|null $role one of the Role::* constants |
| 245 | 245 | * @return array[] list of parameters as accepted by Message::params() |
| 246 | 246 | */ |
| 247 | - private function renderDataValue( DataValue $dataValue, ?string $role ): array { |
|
| 248 | - return [ Message::rawParam( $this->addRole( |
|
| 249 | - $this->dataValueFormatter->format( $dataValue ), |
|
| 247 | + private function renderDataValue(DataValue $dataValue, ?string $role): array { |
|
| 248 | + return [Message::rawParam($this->addRole( |
|
| 249 | + $this->dataValueFormatter->format($dataValue), |
|
| 250 | 250 | $role |
| 251 | - ) ) ]; |
|
| 251 | + ))]; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | /** |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @param string|null $role one of the Role::* constants |
| 257 | 257 | * @return array[] list of parameters as accepted by Message::params() |
| 258 | 258 | */ |
| 259 | - private function renderDataValueType( string $dataValueType, ?string $role ): array { |
|
| 259 | + private function renderDataValueType(string $dataValueType, ?string $role): array { |
|
| 260 | 260 | $messageKeys = [ |
| 261 | 261 | 'string' => 'datatypes-type-string', |
| 262 | 262 | 'monolingualtext' => 'datatypes-type-monolingualtext', |
@@ -265,15 +265,15 @@ discard block |
||
| 265 | 265 | 'wikibase-entityid' => 'wbqc-dataValueType-wikibase-entityid', |
| 266 | 266 | ]; |
| 267 | 267 | |
| 268 | - if ( array_key_exists( $dataValueType, $messageKeys ) ) { |
|
| 269 | - return [ Message::rawParam( $this->addRole( |
|
| 270 | - $this->msgEscaped( $messageKeys[$dataValueType] ), |
|
| 268 | + if (array_key_exists($dataValueType, $messageKeys)) { |
|
| 269 | + return [Message::rawParam($this->addRole( |
|
| 270 | + $this->msgEscaped($messageKeys[$dataValueType]), |
|
| 271 | 271 | $role |
| 272 | - ) ) ]; |
|
| 272 | + ))]; |
|
| 273 | 273 | } else { |
| 274 | 274 | // @codeCoverageIgnoreStart |
| 275 | 275 | throw new LogicException( |
| 276 | - 'Unknown data value type ' . $dataValueType |
|
| 276 | + 'Unknown data value type '.$dataValueType |
|
| 277 | 277 | ); |
| 278 | 278 | // @codeCoverageIgnoreEnd |
| 279 | 279 | } |
@@ -284,11 +284,11 @@ discard block |
||
| 284 | 284 | * @param string|null $role one of the Role::* constants |
| 285 | 285 | * @return array[] list of parameters as accepted by Message::params() |
| 286 | 286 | */ |
| 287 | - private function renderInlineCode( string $code, ?string $role ): array { |
|
| 288 | - return [ Message::rawParam( $this->addRole( |
|
| 289 | - '<code>' . htmlspecialchars( $code ) . '</code>', |
|
| 287 | + private function renderInlineCode(string $code, ?string $role): array { |
|
| 288 | + return [Message::rawParam($this->addRole( |
|
| 289 | + '<code>'.htmlspecialchars($code).'</code>', |
|
| 290 | 290 | $role |
| 291 | - ) ) ]; |
|
| 291 | + ))]; |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | /** |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | * @param string|null $role one of the Role::* constants |
| 297 | 297 | * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ]) |
| 298 | 298 | */ |
| 299 | - private function renderConstraintScope( string $scope, ?string $role ): array { |
|
| 300 | - switch ( $scope ) { |
|
| 299 | + private function renderConstraintScope(string $scope, ?string $role): array { |
|
| 300 | + switch ($scope) { |
|
| 301 | 301 | case Context::TYPE_STATEMENT: |
| 302 | 302 | $itemId = $this->config->get( |
| 303 | 303 | 'WBQualityConstraintsConstraintCheckedOnMainValueId' |
@@ -317,10 +317,10 @@ discard block |
||
| 317 | 317 | // callers should never let this happen, but if it does happen, |
| 318 | 318 | // showing “unknown value” seems reasonable |
| 319 | 319 | // @codeCoverageIgnoreStart |
| 320 | - return $this->renderItemIdSnakValue( ItemIdSnakValue::someValue(), $role ); |
|
| 320 | + return $this->renderItemIdSnakValue(ItemIdSnakValue::someValue(), $role); |
|
| 321 | 321 | // @codeCoverageIgnoreEnd |
| 322 | 322 | } |
| 323 | - return $this->renderEntityId( new ItemId( $itemId ), $role ); |
|
| 323 | + return $this->renderEntityId(new ItemId($itemId), $role); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | * @param string|null $role one of the Role::* constants |
| 329 | 329 | * @return array[] list of parameters as accepted by Message::params() |
| 330 | 330 | */ |
| 331 | - private function renderConstraintScopeList( array $scopeList, ?string $role ): array { |
|
| 332 | - return $this->renderList( $scopeList, $role, [ $this, 'renderConstraintScope' ] ); |
|
| 331 | + private function renderConstraintScopeList(array $scopeList, ?string $role): array { |
|
| 332 | + return $this->renderList($scopeList, $role, [$this, 'renderConstraintScope']); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | /** |
@@ -337,25 +337,25 @@ discard block |
||
| 337 | 337 | * @param string|null $role one of the Role::* constants |
| 338 | 338 | * @return array[] list of a single raw message param (i. e. [ Message::rawParam( … ) ]) |
| 339 | 339 | */ |
| 340 | - private function renderPropertyScope( string $scope, ?string $role ): array { |
|
| 341 | - switch ( $scope ) { |
|
| 340 | + private function renderPropertyScope(string $scope, ?string $role): array { |
|
| 341 | + switch ($scope) { |
|
| 342 | 342 | case Context::TYPE_STATEMENT: |
| 343 | - $itemId = $this->config->get( 'WBQualityConstraintsAsMainValueId' ); |
|
| 343 | + $itemId = $this->config->get('WBQualityConstraintsAsMainValueId'); |
|
| 344 | 344 | break; |
| 345 | 345 | case Context::TYPE_QUALIFIER: |
| 346 | - $itemId = $this->config->get( 'WBQualityConstraintsAsQualifiersId' ); |
|
| 346 | + $itemId = $this->config->get('WBQualityConstraintsAsQualifiersId'); |
|
| 347 | 347 | break; |
| 348 | 348 | case Context::TYPE_REFERENCE: |
| 349 | - $itemId = $this->config->get( 'WBQualityConstraintsAsReferencesId' ); |
|
| 349 | + $itemId = $this->config->get('WBQualityConstraintsAsReferencesId'); |
|
| 350 | 350 | break; |
| 351 | 351 | default: |
| 352 | 352 | // callers should never let this happen, but if it does happen, |
| 353 | 353 | // showing “unknown value” seems reasonable |
| 354 | 354 | // @codeCoverageIgnoreStart |
| 355 | - return $this->renderItemIdSnakValue( ItemIdSnakValue::someValue(), $role ); |
|
| 355 | + return $this->renderItemIdSnakValue(ItemIdSnakValue::someValue(), $role); |
|
| 356 | 356 | // @codeCoverageIgnoreEnd |
| 357 | 357 | } |
| 358 | - return $this->renderEntityId( new ItemId( $itemId ), $role ); |
|
| 358 | + return $this->renderEntityId(new ItemId($itemId), $role); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | /** |
@@ -363,8 +363,8 @@ discard block |
||
| 363 | 363 | * @param string|null $role one of the Role::* constants |
| 364 | 364 | * @return array[] list of parameters as accepted by Message::params() |
| 365 | 365 | */ |
| 366 | - private function renderPropertyScopeList( array $scopeList, ?string $role ): array { |
|
| 367 | - return $this->renderList( $scopeList, $role, [ $this, 'renderPropertyScope' ] ); |
|
| 366 | + private function renderPropertyScopeList(array $scopeList, ?string $role): array { |
|
| 367 | + return $this->renderList($scopeList, $role, [$this, 'renderPropertyScope']); |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | /** |
@@ -372,14 +372,14 @@ discard block |
||
| 372 | 372 | * @param string|null $role one of the Role::* constants |
| 373 | 373 | * @return array[] list of parameters as accepted by Message::params() |
| 374 | 374 | */ |
| 375 | - private function renderLanguage( string $languageCode, ?string $role ): array { |
|
| 375 | + private function renderLanguage(string $languageCode, ?string $role): array { |
|
| 376 | 376 | return [ |
| 377 | 377 | // ::renderList (through ::renderLanguageList) requires 'raw' parameter |
| 378 | 378 | // so we effectively build Message::plaintextParam here |
| 379 | - Message::rawParam( htmlspecialchars( |
|
| 380 | - $this->languageNameUtils->getLanguageName( $languageCode ) |
|
| 381 | - ) ), |
|
| 382 | - Message::plaintextParam( $languageCode ), |
|
| 379 | + Message::rawParam(htmlspecialchars( |
|
| 380 | + $this->languageNameUtils->getLanguageName($languageCode) |
|
| 381 | + )), |
|
| 382 | + Message::plaintextParam($languageCode), |
|
| 383 | 383 | ]; |
| 384 | 384 | } |
| 385 | 385 | |
@@ -388,8 +388,8 @@ discard block |
||
| 388 | 388 | * @param string|null $role one of the Role::* constants |
| 389 | 389 | * @return array[] list of parameters as accepted by Message::params() |
| 390 | 390 | */ |
| 391 | - private function renderLanguageList( array $languageCodes, ?string $role ): array { |
|
| 392 | - return $this->renderList( $languageCodes, $role, [ $this, 'renderLanguage' ] ); |
|
| 391 | + private function renderLanguageList(array $languageCodes, ?string $role): array { |
|
| 392 | + return $this->renderList($languageCodes, $role, [$this, 'renderLanguage']); |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | } |
@@ -25,13 +25,13 @@ discard block |
||
| 25 | 25 | 'wbqc-violation-message-format-clarification' => 'wbqc-violation-message-format', |
| 26 | 26 | ]; |
| 27 | 27 | |
| 28 | - public function render( ViolationMessage $violationMessage ): string { |
|
| 29 | - if ( !array_key_exists( $violationMessage->getMessageKey(), self::ALTERNATIVE_MESSAGE_KEYS ) ) { |
|
| 30 | - return parent::render( $violationMessage ); |
|
| 28 | + public function render(ViolationMessage $violationMessage): string { |
|
| 29 | + if (!array_key_exists($violationMessage->getMessageKey(), self::ALTERNATIVE_MESSAGE_KEYS)) { |
|
| 30 | + return parent::render($violationMessage); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $arguments = $violationMessage->getArguments(); |
| 34 | - $multilingualTextArgument = array_pop( $arguments ); |
|
| 34 | + $multilingualTextArgument = array_pop($arguments); |
|
| 35 | 35 | $multilingualTextParams = $this->renderMultilingualText( |
| 36 | 36 | // @phan-suppress-next-line PhanTypeArraySuspiciousNullable TODO Ensure this is not an actual issue |
| 37 | 37 | $multilingualTextArgument['value'], |
@@ -39,22 +39,22 @@ discard block |
||
| 39 | 39 | $multilingualTextArgument['role'] |
| 40 | 40 | ); |
| 41 | 41 | |
| 42 | - $paramsLists = [ [] ]; |
|
| 43 | - foreach ( $arguments as $argument ) { |
|
| 44 | - $paramsLists[] = $this->renderArgument( $argument ); |
|
| 42 | + $paramsLists = [[]]; |
|
| 43 | + foreach ($arguments as $argument) { |
|
| 44 | + $paramsLists[] = $this->renderArgument($argument); |
|
| 45 | 45 | } |
| 46 | - $regularParams = call_user_func_array( 'array_merge', $paramsLists ); |
|
| 46 | + $regularParams = call_user_func_array('array_merge', $paramsLists); |
|
| 47 | 47 | |
| 48 | - if ( $multilingualTextParams === null ) { |
|
| 48 | + if ($multilingualTextParams === null) { |
|
| 49 | 49 | return $this->messageLocalizer |
| 50 | - ->msg( self::ALTERNATIVE_MESSAGE_KEYS[$violationMessage->getMessageKey()] ) |
|
| 51 | - ->params( $regularParams ) |
|
| 50 | + ->msg(self::ALTERNATIVE_MESSAGE_KEYS[$violationMessage->getMessageKey()]) |
|
| 51 | + ->params($regularParams) |
|
| 52 | 52 | ->escaped(); |
| 53 | 53 | } else { |
| 54 | 54 | return $this->messageLocalizer |
| 55 | - ->msg( $violationMessage->getMessageKey() ) |
|
| 56 | - ->params( $regularParams ) |
|
| 57 | - ->params( $multilingualTextParams ) |
|
| 55 | + ->msg($violationMessage->getMessageKey()) |
|
| 56 | + ->params($regularParams) |
|
| 57 | + ->params($multilingualTextParams) |
|
| 58 | 58 | ->escaped(); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -65,18 +65,18 @@ discard block |
||
| 65 | 65 | * @return array[]|null list of parameters as accepted by Message::params(), |
| 66 | 66 | * or null if the text is not available in the user’s language |
| 67 | 67 | */ |
| 68 | - protected function renderMultilingualText( MultilingualTextValue $text, $role ) { |
|
| 68 | + protected function renderMultilingualText(MultilingualTextValue $text, $role) { |
|
| 69 | 69 | global $wgLang; |
| 70 | 70 | $languageCodes = $wgLang->getFallbackLanguages(); |
| 71 | - array_unshift( $languageCodes, $wgLang->getCode() ); |
|
| 71 | + array_unshift($languageCodes, $wgLang->getCode()); |
|
| 72 | 72 | |
| 73 | 73 | $texts = $text->getTexts(); |
| 74 | - foreach ( $languageCodes as $languageCode ) { |
|
| 75 | - if ( array_key_exists( $languageCode, $texts ) ) { |
|
| 76 | - return [ Message::rawParam( $this->addRole( |
|
| 77 | - htmlspecialchars( $texts[$languageCode]->getText() ), |
|
| 74 | + foreach ($languageCodes as $languageCode) { |
|
| 75 | + if (array_key_exists($languageCode, $texts)) { |
|
| 76 | + return [Message::rawParam($this->addRole( |
|
| 77 | + htmlspecialchars($texts[$languageCode]->getText()), |
|
| 78 | 78 | $role |
| 79 | - ) ) ]; |
|
| 79 | + ))]; |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |