@@ -59,17 +59,17 @@ discard block |
||
59 | 59 | public function __construct( |
60 | 60 | $messageKey |
61 | 61 | ) { |
62 | - if ( strpos( $messageKey, self::MESSAGE_KEY_PREFIX ) !== 0 ) { |
|
62 | + if (strpos($messageKey, self::MESSAGE_KEY_PREFIX) !== 0) { |
|
63 | 63 | throw new InvalidArgumentException( |
64 | - 'ViolationMessage key ⧼' . |
|
65 | - $messageKey . |
|
66 | - '⧽ should start with "' . |
|
67 | - self::MESSAGE_KEY_PREFIX . |
|
64 | + 'ViolationMessage key ⧼'. |
|
65 | + $messageKey. |
|
66 | + '⧽ should start with "'. |
|
67 | + self::MESSAGE_KEY_PREFIX. |
|
68 | 68 | '".' |
69 | 69 | ); |
70 | 70 | } |
71 | 71 | |
72 | - $this->messageKeySuffix = substr( $messageKey, strlen( self::MESSAGE_KEY_PREFIX ) ); |
|
72 | + $this->messageKeySuffix = substr($messageKey, strlen(self::MESSAGE_KEY_PREFIX)); |
|
73 | 73 | $this->arguments = []; |
74 | 74 | } |
75 | 75 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @return string |
79 | 79 | */ |
80 | 80 | public function getMessageKey() { |
81 | - return self::MESSAGE_KEY_PREFIX . $this->messageKeySuffix; |
|
81 | + return self::MESSAGE_KEY_PREFIX.$this->messageKeySuffix; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | * @param mixed $value the value, which should match the $type |
97 | 97 | * @return ViolationMessage |
98 | 98 | */ |
99 | - private function withArgument( $type, $role, $value ) { |
|
99 | + private function withArgument($type, $role, $value) { |
|
100 | 100 | $ret = clone $this; |
101 | - $ret->arguments[] = [ 'type' => $type, 'role' => $role, 'value' => $value ]; |
|
101 | + $ret->arguments[] = ['type' => $type, 'role' => $role, 'value' => $value]; |
|
102 | 102 | return $ret; |
103 | 103 | } |
104 | 104 | |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | * @param string|null $role one of the Role::* constants |
111 | 111 | * @return ViolationMessage |
112 | 112 | */ |
113 | - public function withEntityId( EntityId $entityId, $role = null ) { |
|
114 | - return $this->withArgument( self::TYPE_ENTITY_ID, $role, $entityId ); |
|
113 | + public function withEntityId(EntityId $entityId, $role = null) { |
|
114 | + return $this->withArgument(self::TYPE_ENTITY_ID, $role, $entityId); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | * @param string|null $role one of the Role::* constants |
129 | 129 | * @return ViolationMessage |
130 | 130 | */ |
131 | - public function withEntityIdList( array $entityIdList, $role = null ) { |
|
132 | - return $this->withArgument( self::TYPE_ENTITY_ID_LIST, $role, $entityIdList ); |
|
131 | + public function withEntityIdList(array $entityIdList, $role = null) { |
|
132 | + return $this->withArgument(self::TYPE_ENTITY_ID_LIST, $role, $entityIdList); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | * @param string|null $role one of the Role::* constants |
141 | 141 | * @return ViolationMessage |
142 | 142 | */ |
143 | - public function withItemIdSnakValue( ItemIdSnakValue $value, $role = null ) { |
|
144 | - return $this->withArgument( self::TYPE_ITEM_ID_SNAK_VALUE, $role, $value ); |
|
143 | + public function withItemIdSnakValue(ItemIdSnakValue $value, $role = null) { |
|
144 | + return $this->withArgument(self::TYPE_ITEM_ID_SNAK_VALUE, $role, $value); |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | } |
@@ -87,18 +87,18 @@ discard block |
||
87 | 87 | * @throws ConstraintParameterException |
88 | 88 | * @return CheckResult |
89 | 89 | */ |
90 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
91 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
92 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
90 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
91 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
92 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | $parameters = []; |
96 | 96 | $constraintParameters = $constraint->getConstraintParameters(); |
97 | 97 | |
98 | - $propertyId = $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
99 | - $parameters['property'] = [ $propertyId ]; |
|
98 | + $propertyId = $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
99 | + $parameters['property'] = [$propertyId]; |
|
100 | 100 | |
101 | - $items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false ); |
|
101 | + $items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false); |
|
102 | 102 | $parameters['items'] = $items; |
103 | 103 | |
104 | 104 | /* |
@@ -106,15 +106,15 @@ discard block |
||
106 | 106 | * a) a property only |
107 | 107 | * b) a property and a number of items (each combination of property and item forming an individual claim) |
108 | 108 | */ |
109 | - if ( $items === [] ) { |
|
109 | + if ($items === []) { |
|
110 | 110 | $offendingStatement = $this->connectionCheckerHelper->findStatementWithProperty( |
111 | 111 | $context->getEntity()->getStatements(), |
112 | 112 | $propertyId |
113 | 113 | ); |
114 | - if ( $offendingStatement !== null ) { |
|
115 | - $message = ( new ViolationMessage( 'wbqc-violation-message-conflicts-with-property' ) ) |
|
116 | - ->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ) |
|
117 | - ->withEntityId( $propertyId, Role::PREDICATE ); |
|
114 | + if ($offendingStatement !== null) { |
|
115 | + $message = (new ViolationMessage('wbqc-violation-message-conflicts-with-property')) |
|
116 | + ->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY) |
|
117 | + ->withEntityId($propertyId, Role::PREDICATE); |
|
118 | 118 | $status = CheckResult::STATUS_VIOLATION; |
119 | 119 | } else { |
120 | 120 | $message = null; |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | $propertyId, |
127 | 127 | $items |
128 | 128 | ); |
129 | - if ( $offendingStatement !== null ) { |
|
130 | - $offendingValue = ItemIdSnakValue::fromSnak( $offendingStatement->getMainSnak() ); |
|
131 | - $message = ( new ViolationMessage( 'wbqc-violation-message-conflicts-with-claim' ) ) |
|
132 | - ->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ) |
|
133 | - ->withEntityId( $propertyId, Role::PREDICATE ) |
|
134 | - ->withItemIdSnakValue( $offendingValue, Role::OBJECT ); |
|
129 | + if ($offendingStatement !== null) { |
|
130 | + $offendingValue = ItemIdSnakValue::fromSnak($offendingStatement->getMainSnak()); |
|
131 | + $message = (new ViolationMessage('wbqc-violation-message-conflicts-with-claim')) |
|
132 | + ->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY) |
|
133 | + ->withEntityId($propertyId, Role::PREDICATE) |
|
134 | + ->withItemIdSnakValue($offendingValue, Role::OBJECT); |
|
135 | 135 | $status = CheckResult::STATUS_VIOLATION; |
136 | 136 | } else { |
137 | 137 | $message = null; |
@@ -139,20 +139,20 @@ discard block |
||
139 | 139 | } |
140 | 140 | } |
141 | 141 | |
142 | - return new CheckResult( $context, $constraint, $parameters, $status, $message ); |
|
142 | + return new CheckResult($context, $constraint, $parameters, $status, $message); |
|
143 | 143 | } |
144 | 144 | |
145 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
145 | + public function checkConstraintParameters(Constraint $constraint) { |
|
146 | 146 | $constraintParameters = $constraint->getConstraintParameters(); |
147 | 147 | $exceptions = []; |
148 | 148 | try { |
149 | - $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
150 | - } catch ( ConstraintParameterException $e ) { |
|
149 | + $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
150 | + } catch (ConstraintParameterException $e) { |
|
151 | 151 | $exceptions[] = $e; |
152 | 152 | } |
153 | 153 | try { |
154 | - $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false ); |
|
155 | - } catch ( ConstraintParameterException $e ) { |
|
154 | + $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false); |
|
155 | + } catch (ConstraintParameterException $e) { |
|
156 | 156 | $exceptions[] = $e; |
157 | 157 | } |
158 | 158 | return $exceptions; |
@@ -28,35 +28,35 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * @param DatabaseUpdater $updater |
30 | 30 | */ |
31 | - public static function onCreateSchema( DatabaseUpdater $updater ) { |
|
32 | - $updater->addExtensionTable( 'wbqc_constraints', __DIR__ . '/../sql/create_wbqc_constraints.sql' ); |
|
31 | + public static function onCreateSchema(DatabaseUpdater $updater) { |
|
32 | + $updater->addExtensionTable('wbqc_constraints', __DIR__.'/../sql/create_wbqc_constraints.sql'); |
|
33 | 33 | } |
34 | 34 | |
35 | - public static function onWikibaseChange( Change $change ) { |
|
35 | + public static function onWikibaseChange(Change $change) { |
|
36 | 36 | $config = MediaWikiServices::getInstance()->getMainConfig(); |
37 | - if ( $config->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) && |
|
38 | - self::isConstraintStatementsChange( $config, $change ) |
|
37 | + if ($config->get('WBQualityConstraintsEnableConstraintsImportFromStatements') && |
|
38 | + self::isConstraintStatementsChange($config, $change) |
|
39 | 39 | ) { |
40 | 40 | /** @var EntityChange $change */ |
41 | 41 | $title = Title::newMainPage(); |
42 | - $params = [ 'propertyId' => $change->getEntityId()->getSerialization() ]; |
|
42 | + $params = ['propertyId' => $change->getEntityId()->getSerialization()]; |
|
43 | 43 | JobQueueGroup::singleton()->push( |
44 | - new JobSpecification( 'constraintsTableUpdate', $params, [], $title ) |
|
44 | + new JobSpecification('constraintsTableUpdate', $params, [], $title) |
|
45 | 45 | ); |
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | - public static function isConstraintStatementsChange( Config $config, Change $change ) { |
|
50 | - if ( !( $change instanceof EntityChange ) || |
|
49 | + public static function isConstraintStatementsChange(Config $config, Change $change) { |
|
50 | + if (!($change instanceof EntityChange) || |
|
51 | 51 | $change->getAction() !== EntityChange::UPDATE || |
52 | - !( $change->getEntityId() instanceof PropertyId ) |
|
52 | + !($change->getEntityId() instanceof PropertyId) |
|
53 | 53 | ) { |
54 | 54 | return false; |
55 | 55 | } |
56 | 56 | |
57 | 57 | $info = $change->getInfo(); |
58 | 58 | |
59 | - if ( !array_key_exists( 'compactDiff', $info ) ) { |
|
59 | + if (!array_key_exists('compactDiff', $info)) { |
|
60 | 60 | // the non-compact diff ($info['diff']) does not contain statement diffs (T110996), |
61 | 61 | // so we only know that the change *might* affect the constraint statements |
62 | 62 | return true; |
@@ -65,18 +65,18 @@ discard block |
||
65 | 65 | /** @var EntityDiffChangedAspects $aspects */ |
66 | 66 | $aspects = $info['compactDiff']; |
67 | 67 | |
68 | - $propertyConstraintId = $config->get( 'WBQualityConstraintsPropertyConstraintId' ); |
|
69 | - return in_array( $propertyConstraintId, $aspects->getStatementChanges() ); |
|
68 | + $propertyConstraintId = $config->get('WBQualityConstraintsPropertyConstraintId'); |
|
69 | + return in_array($propertyConstraintId, $aspects->getStatementChanges()); |
|
70 | 70 | } |
71 | 71 | |
72 | - public static function onArticlePurge( WikiPage $wikiPage ) { |
|
72 | + public static function onArticlePurge(WikiPage $wikiPage) { |
|
73 | 73 | $repo = WikibaseRepo::getDefaultInstance(); |
74 | 74 | |
75 | 75 | $entityContentFactory = $repo->getEntityContentFactory(); |
76 | - if ( $entityContentFactory->isEntityContentModel( $wikiPage->getContentModel() ) ) { |
|
77 | - $entityId = $entityContentFactory->getEntityIdForTitle( $wikiPage->getTitle() ); |
|
76 | + if ($entityContentFactory->isEntityContentModel($wikiPage->getContentModel())) { |
|
77 | + $entityId = $entityContentFactory->getEntityIdForTitle($wikiPage->getTitle()); |
|
78 | 78 | $resultsCache = ResultsCache::getDefaultInstance(); |
79 | - $resultsCache->delete( $entityId ); |
|
79 | + $resultsCache->delete($entityId); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
@@ -85,18 +85,18 @@ discard block |
||
85 | 85 | * @param int $timestamp UTC timestamp (seconds since the Epoch) |
86 | 86 | * @return bool |
87 | 87 | */ |
88 | - public static function isGadgetEnabledForUserName( $userName, $timestamp ) { |
|
88 | + public static function isGadgetEnabledForUserName($userName, $timestamp) { |
|
89 | 89 | $initial = $userName[0]; |
90 | 90 | |
91 | - if ( $initial === 'Z' ) { |
|
91 | + if ($initial === 'Z') { |
|
92 | 92 | $firstWeek = 0; |
93 | - } elseif ( $initial >= 'W' && $initial < 'Z' ) { |
|
93 | + } elseif ($initial >= 'W' && $initial < 'Z') { |
|
94 | 94 | $firstWeek = 1; |
95 | - } elseif ( $initial >= 'T' && $initial < 'W' ) { |
|
95 | + } elseif ($initial >= 'T' && $initial < 'W') { |
|
96 | 96 | $firstWeek = 2; |
97 | - } elseif ( $initial >= 'N' && $initial < 'T' ) { |
|
97 | + } elseif ($initial >= 'N' && $initial < 'T') { |
|
98 | 98 | $firstWeek = 3; |
99 | - } elseif ( $initial >= 'E' && $initial < 'N' ) { |
|
99 | + } elseif ($initial >= 'E' && $initial < 'N') { |
|
100 | 100 | $firstWeek = 4; |
101 | 101 | } else { |
102 | 102 | $firstWeek = 5; |
@@ -114,27 +114,27 @@ discard block |
||
114 | 114 | return $timestamp >= $threshold; |
115 | 115 | } |
116 | 116 | |
117 | - public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) { |
|
117 | + public static function onBeforePageDisplay(OutputPage $out, Skin $skin) { |
|
118 | 118 | $repo = WikibaseRepo::getDefaultInstance(); |
119 | 119 | |
120 | 120 | $lookup = $repo->getEntityNamespaceLookup(); |
121 | 121 | $title = $out->getTitle(); |
122 | - if ( $title === null ) { |
|
122 | + if ($title === null) { |
|
123 | 123 | return; |
124 | 124 | } |
125 | 125 | |
126 | - if ( !$lookup->isEntityNamespace( $title->getNamespace() ) ) { |
|
126 | + if (!$lookup->isEntityNamespace($title->getNamespace())) { |
|
127 | 127 | return; |
128 | 128 | } |
129 | - if ( !$out->getUser()->isLoggedIn() ) { |
|
129 | + if (!$out->getUser()->isLoggedIn()) { |
|
130 | 130 | return; |
131 | 131 | } |
132 | - if ( empty( $out->getJsConfigVars()['wbIsEditView'] ) ) { |
|
132 | + if (empty($out->getJsConfigVars()['wbIsEditView'])) { |
|
133 | 133 | return; |
134 | 134 | } |
135 | 135 | |
136 | - if ( self::isGadgetEnabledForUserName( $out->getUser()->getName(), time() ) ) { |
|
137 | - $out->addModules( 'wikibase.quality.constraints.gadget' ); |
|
136 | + if (self::isGadgetEnabledForUserName($out->getUser()->getName(), time())) { |
|
137 | + $out->addModules('wikibase.quality.constraints.gadget'); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 |
@@ -44,84 +44,84 @@ discard block |
||
44 | 44 | * (temporarily, pre-rendered strings are allowed and returned without changes) |
45 | 45 | * @return string |
46 | 46 | */ |
47 | - public function render( $violationMessage ) { |
|
48 | - if ( is_string( $violationMessage ) ) { |
|
47 | + public function render($violationMessage) { |
|
48 | + if (is_string($violationMessage)) { |
|
49 | 49 | // TODO remove this once all checkers produce ViolationMessage objects |
50 | 50 | return $violationMessage; |
51 | 51 | } |
52 | - $message = new Message( $violationMessage->getMessageKey() ); |
|
53 | - foreach ( $violationMessage->getArguments() as $argument ) { |
|
54 | - $this->renderArgument( $argument, $message ); |
|
52 | + $message = new Message($violationMessage->getMessageKey()); |
|
53 | + foreach ($violationMessage->getArguments() as $argument) { |
|
54 | + $this->renderArgument($argument, $message); |
|
55 | 55 | } |
56 | 56 | return $message->escaped(); |
57 | 57 | } |
58 | 58 | |
59 | - private function addRole( $value, $role ) { |
|
60 | - if ( $role === null ) { |
|
59 | + private function addRole($value, $role) { |
|
60 | + if ($role === null) { |
|
61 | 61 | return $value; |
62 | 62 | } |
63 | 63 | |
64 | - return '<span class="wbqc-role wbqc-role-' . htmlspecialchars( $role ) . '">' . |
|
65 | - $value . |
|
64 | + return '<span class="wbqc-role wbqc-role-'.htmlspecialchars($role).'">'. |
|
65 | + $value. |
|
66 | 66 | '</span>'; |
67 | 67 | } |
68 | 68 | |
69 | - private function renderArgument( array $argument, Message $message ) { |
|
69 | + private function renderArgument(array $argument, Message $message) { |
|
70 | 70 | $type = $argument['type']; |
71 | 71 | $value = $argument['value']; |
72 | 72 | $role = $argument['role']; |
73 | - switch ( $type ) { |
|
73 | + switch ($type) { |
|
74 | 74 | case ViolationMessage::TYPE_ENTITY_ID: |
75 | - $params = $this->renderEntityId( $value, $role ); |
|
75 | + $params = $this->renderEntityId($value, $role); |
|
76 | 76 | break; |
77 | 77 | case ViolationMessage::TYPE_ENTITY_ID_LIST: |
78 | - $params = $this->renderEntityIdList( $value, $role ); |
|
78 | + $params = $this->renderEntityIdList($value, $role); |
|
79 | 79 | break; |
80 | 80 | case ViolationMessage::TYPE_ITEM_ID_SNAK_VALUE: |
81 | - $params = $this->renderItemIdSnakValue( $value, $role ); |
|
81 | + $params = $this->renderItemIdSnakValue($value, $role); |
|
82 | 82 | break; |
83 | 83 | default: |
84 | 84 | throw new InvalidArgumentException( |
85 | - 'Unknown ViolationMessage argument type ' . $type . '!' |
|
85 | + 'Unknown ViolationMessage argument type '.$type.'!' |
|
86 | 86 | ); |
87 | 87 | } |
88 | - $message->params( $params ); |
|
88 | + $message->params($params); |
|
89 | 89 | } |
90 | 90 | |
91 | - private function renderList( array $list, $role, callable $render ) { |
|
92 | - if ( $list === [] ) { |
|
91 | + private function renderList(array $list, $role, callable $render) { |
|
92 | + if ($list === []) { |
|
93 | 93 | return [ |
94 | - Message::numParam( 0 ), |
|
95 | - Message::rawParam( '<ul></ul>' ), |
|
94 | + Message::numParam(0), |
|
95 | + Message::rawParam('<ul></ul>'), |
|
96 | 96 | ]; |
97 | 97 | } |
98 | 98 | |
99 | - if ( count( $list ) > $this->maxListLength ) { |
|
100 | - $list = array_slice( $list, 0, $this->maxListLength ); |
|
99 | + if (count($list) > $this->maxListLength) { |
|
100 | + $list = array_slice($list, 0, $this->maxListLength); |
|
101 | 101 | $truncated = true; |
102 | 102 | } |
103 | 103 | |
104 | 104 | $renderedParams = array_map( |
105 | 105 | $render, |
106 | 106 | $list, |
107 | - array_fill( 0, count( $list ), $role ) |
|
107 | + array_fill(0, count($list), $role) |
|
108 | 108 | ); |
109 | 109 | $renderedElements = array_map( |
110 | - function ( $param ) { |
|
110 | + function($param) { |
|
111 | 111 | return $param['raw']; |
112 | 112 | }, |
113 | 113 | $renderedParams |
114 | 114 | ); |
115 | - if ( isset( $truncated ) ) { |
|
116 | - $renderedElements[] = wfMessage( 'ellipsis' )->escaped(); |
|
115 | + if (isset($truncated)) { |
|
116 | + $renderedElements[] = wfMessage('ellipsis')->escaped(); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | return array_merge( |
120 | 120 | [ |
121 | - Message::numParam( count( $list ) ), |
|
121 | + Message::numParam(count($list)), |
|
122 | 122 | Message::rawParam( |
123 | - '<ul><li>' . |
|
124 | - implode( '</li><li>', $renderedElements ) . |
|
123 | + '<ul><li>'. |
|
124 | + implode('</li><li>', $renderedElements). |
|
125 | 125 | '</li></ul>' |
126 | 126 | ), |
127 | 127 | ], |
@@ -129,35 +129,35 @@ discard block |
||
129 | 129 | ); |
130 | 130 | } |
131 | 131 | |
132 | - private function renderEntityId( EntityId $entityId, $role ) { |
|
133 | - return Message::rawParam( $this->addRole( |
|
134 | - $this->entityIdFormatter->formatEntityId( $entityId ), |
|
132 | + private function renderEntityId(EntityId $entityId, $role) { |
|
133 | + return Message::rawParam($this->addRole( |
|
134 | + $this->entityIdFormatter->formatEntityId($entityId), |
|
135 | 135 | $role |
136 | - ) ); |
|
136 | + )); |
|
137 | 137 | } |
138 | 138 | |
139 | - private function renderEntityIdList( array $entityIdList, $role ) { |
|
140 | - return $this->renderList( $entityIdList, $role, [ $this, 'renderEntityId' ] ); |
|
139 | + private function renderEntityIdList(array $entityIdList, $role) { |
|
140 | + return $this->renderList($entityIdList, $role, [$this, 'renderEntityId']); |
|
141 | 141 | } |
142 | 142 | |
143 | - private function renderItemIdSnakValue( ItemIdSnakValue $value, $role ) { |
|
144 | - switch ( true ) { |
|
143 | + private function renderItemIdSnakValue(ItemIdSnakValue $value, $role) { |
|
144 | + switch (true) { |
|
145 | 145 | case $value->isValue(): |
146 | - return $this->renderEntityId( $value->getItemId(), $role ); |
|
146 | + return $this->renderEntityId($value->getItemId(), $role); |
|
147 | 147 | case $value->isSomeValue(): |
148 | - return Message::rawParam( $this->addRole( |
|
149 | - '<span class="wikibase-snakview-variation-somevaluesnak">' . |
|
150 | - wfMessage( 'wikibase-snakview-snaktypeselector-somevalue' )->escaped() . |
|
148 | + return Message::rawParam($this->addRole( |
|
149 | + '<span class="wikibase-snakview-variation-somevaluesnak">'. |
|
150 | + wfMessage('wikibase-snakview-snaktypeselector-somevalue')->escaped(). |
|
151 | 151 | '</span>', |
152 | 152 | $role |
153 | - ) ); |
|
153 | + )); |
|
154 | 154 | case $value->isNoValue(): |
155 | - return Message::rawParam( $this->addRole( |
|
156 | - '<span class="wikibase-snakview-variation-novaluesnak">' . |
|
157 | - wfMessage( 'wikibase-snakview-snaktypeselector-novalue' )->escaped() . |
|
155 | + return Message::rawParam($this->addRole( |
|
156 | + '<span class="wikibase-snakview-variation-novaluesnak">'. |
|
157 | + wfMessage('wikibase-snakview-snaktypeselector-novalue')->escaped(). |
|
158 | 158 | '</span>', |
159 | 159 | $role |
160 | - ) ); |
|
160 | + )); |
|
161 | 161 | default: |
162 | 162 | // @codeCoverageIgnoreStart |
163 | 163 | throw new LogicException( |