@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | * @param ViolationMessage $violationMessage |
30 | 30 | * @return string |
31 | 31 | */ |
32 | - public function render( ViolationMessage $violationMessage ) { |
|
33 | - if ( !array_key_exists( $violationMessage->getMessageKey(), self::ALTERNATIVE_MESSAGE_KEYS ) ) { |
|
34 | - return parent::render( $violationMessage ); |
|
32 | + public function render(ViolationMessage $violationMessage) { |
|
33 | + if (!array_key_exists($violationMessage->getMessageKey(), self::ALTERNATIVE_MESSAGE_KEYS)) { |
|
34 | + return parent::render($violationMessage); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | $arguments = $violationMessage->getArguments(); |
38 | - $multilingualTextArgument = array_pop( $arguments ); |
|
38 | + $multilingualTextArgument = array_pop($arguments); |
|
39 | 39 | $multilingualTextParams = $this->renderMultilingualText( |
40 | 40 | // @phan-suppress-next-line PhanTypeArraySuspiciousNullable TODO Ensure this is not an actual issue |
41 | 41 | $multilingualTextArgument['value'], |
@@ -43,22 +43,22 @@ discard block |
||
43 | 43 | $multilingualTextArgument['role'] |
44 | 44 | ); |
45 | 45 | |
46 | - $paramsLists = [ [] ]; |
|
47 | - foreach ( $arguments as $argument ) { |
|
48 | - $paramsLists[] = $this->renderArgument( $argument ); |
|
46 | + $paramsLists = [[]]; |
|
47 | + foreach ($arguments as $argument) { |
|
48 | + $paramsLists[] = $this->renderArgument($argument); |
|
49 | 49 | } |
50 | - $regularParams = call_user_func_array( 'array_merge', $paramsLists ); |
|
50 | + $regularParams = call_user_func_array('array_merge', $paramsLists); |
|
51 | 51 | |
52 | - if ( $multilingualTextParams === null ) { |
|
52 | + if ($multilingualTextParams === null) { |
|
53 | 53 | return $this->messageLocalizer |
54 | - ->msg( self::ALTERNATIVE_MESSAGE_KEYS[$violationMessage->getMessageKey()] ) |
|
55 | - ->params( $regularParams ) |
|
54 | + ->msg(self::ALTERNATIVE_MESSAGE_KEYS[$violationMessage->getMessageKey()]) |
|
55 | + ->params($regularParams) |
|
56 | 56 | ->escaped(); |
57 | 57 | } else { |
58 | 58 | return $this->messageLocalizer |
59 | - ->msg( $violationMessage->getMessageKey() ) |
|
60 | - ->params( $regularParams ) |
|
61 | - ->params( $multilingualTextParams ) |
|
59 | + ->msg($violationMessage->getMessageKey()) |
|
60 | + ->params($regularParams) |
|
61 | + ->params($multilingualTextParams) |
|
62 | 62 | ->escaped(); |
63 | 63 | } |
64 | 64 | } |
@@ -69,18 +69,18 @@ discard block |
||
69 | 69 | * @return array[]|null list of parameters as accepted by Message::params(), |
70 | 70 | * or null if the text is not available in the user’s language |
71 | 71 | */ |
72 | - protected function renderMultilingualText( MultilingualTextValue $text, $role ) { |
|
72 | + protected function renderMultilingualText(MultilingualTextValue $text, $role) { |
|
73 | 73 | global $wgLang; |
74 | 74 | $languageCodes = $wgLang->getFallbackLanguages(); |
75 | - array_unshift( $languageCodes, $wgLang->getCode() ); |
|
75 | + array_unshift($languageCodes, $wgLang->getCode()); |
|
76 | 76 | |
77 | 77 | $texts = $text->getTexts(); |
78 | - foreach ( $languageCodes as $languageCode ) { |
|
79 | - if ( array_key_exists( $languageCode, $texts ) ) { |
|
80 | - return [ Message::rawParam( $this->addRole( |
|
81 | - htmlspecialchars( $texts[$languageCode]->getText() ), |
|
78 | + foreach ($languageCodes as $languageCode) { |
|
79 | + if (array_key_exists($languageCode, $texts)) { |
|
80 | + return [Message::rawParam($this->addRole( |
|
81 | + htmlspecialchars($texts[$languageCode]->getText()), |
|
82 | 82 | $role |
83 | - ) ) ]; |
|
83 | + ))]; |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 |