@@ -68,41 +68,41 @@ |
||
68 | 68 | * @throws ConstraintParameterException |
69 | 69 | * @return CheckResult |
70 | 70 | */ |
71 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
72 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
73 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
71 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
72 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
73 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $parameters = []; |
77 | 77 | $constraintParameters = $constraint->getConstraintParameters(); |
78 | 78 | |
79 | - $items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), true ); |
|
79 | + $items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), true); |
|
80 | 80 | $parameters['item'] = $items; |
81 | 81 | |
82 | 82 | $snak = $context->getSnak(); |
83 | 83 | |
84 | - $message = ( new ViolationMessage( 'wbqc-violation-message-one-of' ) ) |
|
85 | - ->withEntityId( $context->getSnak()->getPropertyId(), Role::PREDICATE ) |
|
86 | - ->withItemIdSnakValueList( $items, Role::OBJECT ); |
|
84 | + $message = (new ViolationMessage('wbqc-violation-message-one-of')) |
|
85 | + ->withEntityId($context->getSnak()->getPropertyId(), Role::PREDICATE) |
|
86 | + ->withItemIdSnakValueList($items, Role::OBJECT); |
|
87 | 87 | $status = CheckResult::STATUS_VIOLATION; |
88 | 88 | |
89 | - foreach ( $items as $item ) { |
|
90 | - if ( $item->matchesSnak( $snak ) ) { |
|
89 | + foreach ($items as $item) { |
|
90 | + if ($item->matchesSnak($snak)) { |
|
91 | 91 | $message = null; |
92 | 92 | $status = CheckResult::STATUS_COMPLIANCE; |
93 | 93 | break; |
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | - return new CheckResult( $context, $constraint, $parameters, $status, $message ); |
|
97 | + return new CheckResult($context, $constraint, $parameters, $status, $message); |
|
98 | 98 | } |
99 | 99 | |
100 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
100 | + public function checkConstraintParameters(Constraint $constraint) { |
|
101 | 101 | $constraintParameters = $constraint->getConstraintParameters(); |
102 | 102 | $exceptions = []; |
103 | 103 | try { |
104 | - $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), true ); |
|
105 | - } catch ( ConstraintParameterException $e ) { |
|
104 | + $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), true); |
|
105 | + } catch (ConstraintParameterException $e) { |
|
106 | 106 | $exceptions[] = $e; |
107 | 107 | } |
108 | 108 | return $exceptions; |
@@ -86,18 +86,18 @@ discard block |
||
86 | 86 | * @throws ConstraintParameterException |
87 | 87 | * @return CheckResult |
88 | 88 | */ |
89 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
90 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
91 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
89 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
90 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
91 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | $parameters = []; |
95 | 95 | $constraintParameters = $constraint->getConstraintParameters(); |
96 | 96 | |
97 | - $propertyId = $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
98 | - $parameters['property'] = [ $propertyId ]; |
|
97 | + $propertyId = $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
98 | + $parameters['property'] = [$propertyId]; |
|
99 | 99 | |
100 | - $items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false ); |
|
100 | + $items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false); |
|
101 | 101 | $parameters['items'] = $items; |
102 | 102 | |
103 | 103 | /* |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * a) a property only |
106 | 106 | * b) a property and a number of items (each combination of property and item forming an individual claim) |
107 | 107 | */ |
108 | - if ( $items === [] ) { |
|
108 | + if ($items === []) { |
|
109 | 109 | $requiredStatement = $this->connectionCheckerHelper->findStatementWithProperty( |
110 | 110 | $context->getEntity()->getStatements(), |
111 | 111 | $propertyId |
@@ -118,31 +118,31 @@ discard block |
||
118 | 118 | ); |
119 | 119 | } |
120 | 120 | |
121 | - if ( $requiredStatement !== null ) { |
|
121 | + if ($requiredStatement !== null) { |
|
122 | 122 | $status = CheckResult::STATUS_COMPLIANCE; |
123 | 123 | $message = null; |
124 | 124 | } else { |
125 | 125 | $status = CheckResult::STATUS_VIOLATION; |
126 | - $message = ( new ViolationMessage( 'wbqc-violation-message-item' ) ) |
|
127 | - ->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ) |
|
128 | - ->withEntityId( $propertyId, Role::PREDICATE ) |
|
129 | - ->withItemIdSnakValueList( $items, Role::OBJECT ); |
|
126 | + $message = (new ViolationMessage('wbqc-violation-message-item')) |
|
127 | + ->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY) |
|
128 | + ->withEntityId($propertyId, Role::PREDICATE) |
|
129 | + ->withItemIdSnakValueList($items, Role::OBJECT); |
|
130 | 130 | } |
131 | 131 | |
132 | - return new CheckResult( $context, $constraint, $parameters, $status, $message ); |
|
132 | + return new CheckResult($context, $constraint, $parameters, $status, $message); |
|
133 | 133 | } |
134 | 134 | |
135 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
135 | + public function checkConstraintParameters(Constraint $constraint) { |
|
136 | 136 | $constraintParameters = $constraint->getConstraintParameters(); |
137 | 137 | $exceptions = []; |
138 | 138 | try { |
139 | - $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
140 | - } catch ( ConstraintParameterException $e ) { |
|
139 | + $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
140 | + } catch (ConstraintParameterException $e) { |
|
141 | 141 | $exceptions[] = $e; |
142 | 142 | } |
143 | 143 | try { |
144 | - $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false ); |
|
145 | - } catch ( ConstraintParameterException $e ) { |
|
144 | + $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false); |
|
145 | + } catch (ConstraintParameterException $e) { |
|
146 | 146 | $exceptions[] = $e; |
147 | 147 | } |
148 | 148 | return $exceptions; |
@@ -88,25 +88,25 @@ discard block |
||
88 | 88 | * @throws ConstraintParameterException |
89 | 89 | * @return CheckResult |
90 | 90 | */ |
91 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
92 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
93 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
91 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
92 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
93 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $parameters = []; |
97 | 97 | $constraintParameters = $constraint->getConstraintParameters(); |
98 | 98 | |
99 | - $propertyId = $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
100 | - $parameters['property'] = [ $propertyId ]; |
|
99 | + $propertyId = $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
100 | + $parameters['property'] = [$propertyId]; |
|
101 | 101 | |
102 | - $items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false ); |
|
102 | + $items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false); |
|
103 | 103 | $parameters['items'] = $items; |
104 | 104 | |
105 | 105 | $snak = $context->getSnak(); |
106 | 106 | |
107 | - if ( !$snak instanceof PropertyValueSnak ) { |
|
107 | + if (!$snak instanceof PropertyValueSnak) { |
|
108 | 108 | // nothing to check |
109 | - return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE ); |
|
109 | + return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $dataValue = $snak->getDataValue(); |
@@ -115,22 +115,22 @@ discard block |
||
115 | 115 | * error handling: |
116 | 116 | * type of $dataValue for properties with 'Target required claim' constraint has to be 'wikibase-entityid' |
117 | 117 | */ |
118 | - if ( $dataValue->getType() !== 'wikibase-entityid' ) { |
|
119 | - $message = wfMessage( "wbqc-violation-message-value-needed-of-type" ) |
|
118 | + if ($dataValue->getType() !== 'wikibase-entityid') { |
|
119 | + $message = wfMessage("wbqc-violation-message-value-needed-of-type") |
|
120 | 120 | ->rawParams( |
121 | - $this->constraintParameterRenderer->formatItemId( $constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM ), |
|
121 | + $this->constraintParameterRenderer->formatItemId($constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM), |
|
122 | 122 | 'wikibase-entityid' // TODO is there a message for this type so we can localize it? |
123 | 123 | ) |
124 | 124 | ->escaped(); |
125 | - return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message ); |
|
125 | + return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message); |
|
126 | 126 | } |
127 | 127 | /** @var EntityIdValue $dataValue */ |
128 | 128 | |
129 | 129 | $targetEntityId = $dataValue->getEntityId(); |
130 | - $targetEntity = $this->entityLookup->getEntity( $targetEntityId ); |
|
131 | - if ( $targetEntity === null ) { |
|
132 | - $message = new ViolationMessage( 'wbqc-violation-message-target-entity-must-exist' ); |
|
133 | - return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message ); |
|
130 | + $targetEntity = $this->entityLookup->getEntity($targetEntityId); |
|
131 | + if ($targetEntity === null) { |
|
132 | + $message = new ViolationMessage('wbqc-violation-message-target-entity-must-exist'); |
|
133 | + return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /* |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * a) a property only |
139 | 139 | * b) a property and a number of items (each combination forming an individual claim) |
140 | 140 | */ |
141 | - if ( $items === [] ) { |
|
141 | + if ($items === []) { |
|
142 | 142 | $requiredStatement = $this->connectionCheckerHelper->findStatementWithProperty( |
143 | 143 | $targetEntity->getStatements(), |
144 | 144 | $propertyId |
@@ -151,33 +151,33 @@ discard block |
||
151 | 151 | ); |
152 | 152 | } |
153 | 153 | |
154 | - if ( $requiredStatement !== null ) { |
|
154 | + if ($requiredStatement !== null) { |
|
155 | 155 | $status = CheckResult::STATUS_COMPLIANCE; |
156 | 156 | $message = null; |
157 | 157 | } else { |
158 | 158 | $status = CheckResult::STATUS_VIOLATION; |
159 | - $message = ( new ViolationMessage( 'wbqc-violation-message-target-required-claim' ) ) |
|
160 | - ->withEntityId( $targetEntityId, Role::SUBJECT ) |
|
161 | - ->withEntityId( $propertyId, Role::PREDICATE ) |
|
162 | - ->withItemIdSnakValueList( $items, Role::OBJECT ); |
|
159 | + $message = (new ViolationMessage('wbqc-violation-message-target-required-claim')) |
|
160 | + ->withEntityId($targetEntityId, Role::SUBJECT) |
|
161 | + ->withEntityId($propertyId, Role::PREDICATE) |
|
162 | + ->withItemIdSnakValueList($items, Role::OBJECT); |
|
163 | 163 | } |
164 | 164 | |
165 | - return ( new CheckResult( $context, $constraint, $parameters, $status, $message ) ) |
|
166 | - ->withMetadata( Metadata::ofDependencyMetadata( |
|
167 | - DependencyMetadata::ofEntityId( $targetEntityId ) ) ); |
|
165 | + return (new CheckResult($context, $constraint, $parameters, $status, $message)) |
|
166 | + ->withMetadata(Metadata::ofDependencyMetadata( |
|
167 | + DependencyMetadata::ofEntityId($targetEntityId) )); |
|
168 | 168 | } |
169 | 169 | |
170 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
170 | + public function checkConstraintParameters(Constraint $constraint) { |
|
171 | 171 | $constraintParameters = $constraint->getConstraintParameters(); |
172 | 172 | $exceptions = []; |
173 | 173 | try { |
174 | - $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
175 | - } catch ( ConstraintParameterException $e ) { |
|
174 | + $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
175 | + } catch (ConstraintParameterException $e) { |
|
176 | 176 | $exceptions[] = $e; |
177 | 177 | } |
178 | 178 | try { |
179 | - $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false ); |
|
180 | - } catch ( ConstraintParameterException $e ) { |
|
179 | + $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false); |
|
180 | + } catch (ConstraintParameterException $e) { |
|
181 | 181 | $exceptions[] = $e; |
182 | 182 | } |
183 | 183 | return $exceptions; |
@@ -44,87 +44,87 @@ 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 | case ViolationMessage::TYPE_ITEM_ID_SNAK_VALUE_LIST: |
84 | - $params = $this->renderItemIdSnakValueList( $value, $role ); |
|
84 | + $params = $this->renderItemIdSnakValueList($value, $role); |
|
85 | 85 | break; |
86 | 86 | default: |
87 | 87 | throw new InvalidArgumentException( |
88 | - 'Unknown ViolationMessage argument type ' . $type . '!' |
|
88 | + 'Unknown ViolationMessage argument type '.$type.'!' |
|
89 | 89 | ); |
90 | 90 | } |
91 | - $message->params( $params ); |
|
91 | + $message->params($params); |
|
92 | 92 | } |
93 | 93 | |
94 | - private function renderList( array $list, $role, callable $render ) { |
|
95 | - if ( $list === [] ) { |
|
94 | + private function renderList(array $list, $role, callable $render) { |
|
95 | + if ($list === []) { |
|
96 | 96 | return [ |
97 | - Message::numParam( 0 ), |
|
98 | - Message::rawParam( '<ul></ul>' ), |
|
97 | + Message::numParam(0), |
|
98 | + Message::rawParam('<ul></ul>'), |
|
99 | 99 | ]; |
100 | 100 | } |
101 | 101 | |
102 | - if ( count( $list ) > $this->maxListLength ) { |
|
103 | - $list = array_slice( $list, 0, $this->maxListLength ); |
|
102 | + if (count($list) > $this->maxListLength) { |
|
103 | + $list = array_slice($list, 0, $this->maxListLength); |
|
104 | 104 | $truncated = true; |
105 | 105 | } |
106 | 106 | |
107 | 107 | $renderedParams = array_map( |
108 | 108 | $render, |
109 | 109 | $list, |
110 | - array_fill( 0, count( $list ), $role ) |
|
110 | + array_fill(0, count($list), $role) |
|
111 | 111 | ); |
112 | 112 | $renderedElements = array_map( |
113 | - function ( $param ) { |
|
113 | + function($param) { |
|
114 | 114 | return $param['raw']; |
115 | 115 | }, |
116 | 116 | $renderedParams |
117 | 117 | ); |
118 | - if ( isset( $truncated ) ) { |
|
119 | - $renderedElements[] = wfMessage( 'ellipsis' )->escaped(); |
|
118 | + if (isset($truncated)) { |
|
119 | + $renderedElements[] = wfMessage('ellipsis')->escaped(); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | return array_merge( |
123 | 123 | [ |
124 | - Message::numParam( count( $list ) ), |
|
124 | + Message::numParam(count($list)), |
|
125 | 125 | Message::rawParam( |
126 | - '<ul><li>' . |
|
127 | - implode( '</li><li>', $renderedElements ) . |
|
126 | + '<ul><li>'. |
|
127 | + implode('</li><li>', $renderedElements). |
|
128 | 128 | '</li></ul>' |
129 | 129 | ), |
130 | 130 | ], |
@@ -132,35 +132,35 @@ discard block |
||
132 | 132 | ); |
133 | 133 | } |
134 | 134 | |
135 | - private function renderEntityId( EntityId $entityId, $role ) { |
|
136 | - return Message::rawParam( $this->addRole( |
|
137 | - $this->entityIdFormatter->formatEntityId( $entityId ), |
|
135 | + private function renderEntityId(EntityId $entityId, $role) { |
|
136 | + return Message::rawParam($this->addRole( |
|
137 | + $this->entityIdFormatter->formatEntityId($entityId), |
|
138 | 138 | $role |
139 | - ) ); |
|
139 | + )); |
|
140 | 140 | } |
141 | 141 | |
142 | - private function renderEntityIdList( array $entityIdList, $role ) { |
|
143 | - return $this->renderList( $entityIdList, $role, [ $this, 'renderEntityId' ] ); |
|
142 | + private function renderEntityIdList(array $entityIdList, $role) { |
|
143 | + return $this->renderList($entityIdList, $role, [$this, 'renderEntityId']); |
|
144 | 144 | } |
145 | 145 | |
146 | - private function renderItemIdSnakValue( ItemIdSnakValue $value, $role ) { |
|
147 | - switch ( true ) { |
|
146 | + private function renderItemIdSnakValue(ItemIdSnakValue $value, $role) { |
|
147 | + switch (true) { |
|
148 | 148 | case $value->isValue(): |
149 | - return $this->renderEntityId( $value->getItemId(), $role ); |
|
149 | + return $this->renderEntityId($value->getItemId(), $role); |
|
150 | 150 | case $value->isSomeValue(): |
151 | - return Message::rawParam( $this->addRole( |
|
152 | - '<span class="wikibase-snakview-variation-somevaluesnak">' . |
|
153 | - wfMessage( 'wikibase-snakview-snaktypeselector-somevalue' )->escaped() . |
|
151 | + return Message::rawParam($this->addRole( |
|
152 | + '<span class="wikibase-snakview-variation-somevaluesnak">'. |
|
153 | + wfMessage('wikibase-snakview-snaktypeselector-somevalue')->escaped(). |
|
154 | 154 | '</span>', |
155 | 155 | $role |
156 | - ) ); |
|
156 | + )); |
|
157 | 157 | case $value->isNoValue(): |
158 | - return Message::rawParam( $this->addRole( |
|
159 | - '<span class="wikibase-snakview-variation-novaluesnak">' . |
|
160 | - wfMessage( 'wikibase-snakview-snaktypeselector-novalue' )->escaped() . |
|
158 | + return Message::rawParam($this->addRole( |
|
159 | + '<span class="wikibase-snakview-variation-novaluesnak">'. |
|
160 | + wfMessage('wikibase-snakview-snaktypeselector-novalue')->escaped(). |
|
161 | 161 | '</span>', |
162 | 162 | $role |
163 | - ) ); |
|
163 | + )); |
|
164 | 164 | default: |
165 | 165 | // @codeCoverageIgnoreStart |
166 | 166 | throw new LogicException( |
@@ -170,8 +170,8 @@ discard block |
||
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
173 | - private function renderItemIdSnakValueList( array $valueList, $role ) { |
|
174 | - return $this->renderList( $valueList, $role, [ $this, 'renderItemIdSnakValue' ] ); |
|
173 | + private function renderItemIdSnakValueList(array $valueList, $role) { |
|
174 | + return $this->renderList($valueList, $role, [$this, 'renderItemIdSnakValue']); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | } |
@@ -65,17 +65,17 @@ discard block |
||
65 | 65 | public function __construct( |
66 | 66 | $messageKey |
67 | 67 | ) { |
68 | - if ( strpos( $messageKey, self::MESSAGE_KEY_PREFIX ) !== 0 ) { |
|
68 | + if (strpos($messageKey, self::MESSAGE_KEY_PREFIX) !== 0) { |
|
69 | 69 | throw new InvalidArgumentException( |
70 | - 'ViolationMessage key ⧼' . |
|
71 | - $messageKey . |
|
72 | - '⧽ should start with "' . |
|
73 | - self::MESSAGE_KEY_PREFIX . |
|
70 | + 'ViolationMessage key ⧼'. |
|
71 | + $messageKey. |
|
72 | + '⧽ should start with "'. |
|
73 | + self::MESSAGE_KEY_PREFIX. |
|
74 | 74 | '".' |
75 | 75 | ); |
76 | 76 | } |
77 | 77 | |
78 | - $this->messageKeySuffix = substr( $messageKey, strlen( self::MESSAGE_KEY_PREFIX ) ); |
|
78 | + $this->messageKeySuffix = substr($messageKey, strlen(self::MESSAGE_KEY_PREFIX)); |
|
79 | 79 | $this->arguments = []; |
80 | 80 | } |
81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @return string |
85 | 85 | */ |
86 | 86 | public function getMessageKey() { |
87 | - return self::MESSAGE_KEY_PREFIX . $this->messageKeySuffix; |
|
87 | + return self::MESSAGE_KEY_PREFIX.$this->messageKeySuffix; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -102,9 +102,9 @@ discard block |
||
102 | 102 | * @param mixed $value the value, which should match the $type |
103 | 103 | * @return ViolationMessage |
104 | 104 | */ |
105 | - private function withArgument( $type, $role, $value ) { |
|
105 | + private function withArgument($type, $role, $value) { |
|
106 | 106 | $ret = clone $this; |
107 | - $ret->arguments[] = [ 'type' => $type, 'role' => $role, 'value' => $value ]; |
|
107 | + $ret->arguments[] = ['type' => $type, 'role' => $role, 'value' => $value]; |
|
108 | 108 | return $ret; |
109 | 109 | } |
110 | 110 | |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * @param string|null $role one of the Role::* constants |
117 | 117 | * @return ViolationMessage |
118 | 118 | */ |
119 | - public function withEntityId( EntityId $entityId, $role = null ) { |
|
120 | - return $this->withArgument( self::TYPE_ENTITY_ID, $role, $entityId ); |
|
119 | + public function withEntityId(EntityId $entityId, $role = null) { |
|
120 | + return $this->withArgument(self::TYPE_ENTITY_ID, $role, $entityId); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | * @param string|null $role one of the Role::* constants |
135 | 135 | * @return ViolationMessage |
136 | 136 | */ |
137 | - public function withEntityIdList( array $entityIdList, $role = null ) { |
|
138 | - return $this->withArgument( self::TYPE_ENTITY_ID_LIST, $role, $entityIdList ); |
|
137 | + public function withEntityIdList(array $entityIdList, $role = null) { |
|
138 | + return $this->withArgument(self::TYPE_ENTITY_ID_LIST, $role, $entityIdList); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | * @param string|null $role one of the Role::* constants |
147 | 147 | * @return ViolationMessage |
148 | 148 | */ |
149 | - public function withItemIdSnakValue( ItemIdSnakValue $value, $role = null ) { |
|
150 | - return $this->withArgument( self::TYPE_ITEM_ID_SNAK_VALUE, $role, $value ); |
|
149 | + public function withItemIdSnakValue(ItemIdSnakValue $value, $role = null) { |
|
150 | + return $this->withArgument(self::TYPE_ITEM_ID_SNAK_VALUE, $role, $value); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | * @param string|null $role one of the Role::* constants |
165 | 165 | * @return ViolationMessage |
166 | 166 | */ |
167 | - public function withItemIdSnakValueList( array $valueList, $role = null ) { |
|
168 | - return $this->withArgument( self::TYPE_ITEM_ID_SNAK_VALUE_LIST, $role, $valueList ); |
|
167 | + public function withItemIdSnakValueList(array $valueList, $role = null) { |
|
168 | + return $this->withArgument(self::TYPE_ITEM_ID_SNAK_VALUE_LIST, $role, $valueList); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | } |