@@ -74,18 +74,18 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return self |
76 | 76 | */ |
77 | - public static function newFromGlobalState( ApiMain $main, $name, $prefix = '' ) { |
|
77 | + public static function newFromGlobalState(ApiMain $main, $name, $prefix = '') { |
|
78 | 78 | $constraintReportFactory = ConstraintReportFactory::getDefaultInstance(); |
79 | 79 | $repo = WikibaseRepo::getDefaultInstance(); |
80 | - $helperFactory = $repo->getApiHelperFactory( RequestContext::getMain() ); |
|
80 | + $helperFactory = $repo->getApiHelperFactory(RequestContext::getMain()); |
|
81 | 81 | $language = $repo->getUserLanguage(); |
82 | 82 | |
83 | 83 | $entityIdHtmlLinkFormatterFactory = $repo->getEntityIdHtmlLinkFormatterFactory(); |
84 | - $entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter( $language ); |
|
84 | + $entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter($language); |
|
85 | 85 | $formatterOptions = new FormatterOptions(); |
86 | - $formatterOptions->setOption( SnakFormatter::OPT_LANG, $language->getCode() ); |
|
86 | + $formatterOptions->setOption(SnakFormatter::OPT_LANG, $language->getCode()); |
|
87 | 87 | $valueFormatterFactory = $repo->getValueFormatterFactory(); |
88 | - $dataValueFormatter = $valueFormatterFactory->getValueFormatter( SnakFormatter::FORMAT_HTML, $formatterOptions ); |
|
88 | + $dataValueFormatter = $valueFormatterFactory->getValueFormatter(SnakFormatter::FORMAT_HTML, $formatterOptions); |
|
89 | 89 | $config = MediaWikiServices::getInstance()->getMainConfig(); |
90 | 90 | $violationMessageRenderer = new MultilingualTextViolationMessageRenderer( |
91 | 91 | $entityIdHtmlLinkFormatter, |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | StatementGuidParser $statementGuidParser, |
126 | 126 | IBufferingStatsdDataFactory $dataFactory |
127 | 127 | ) { |
128 | - parent::__construct( $main, $name, $prefix ); |
|
128 | + parent::__construct($main, $name, $prefix); |
|
129 | 129 | |
130 | - $this->apiErrorReporter = $apiHelperFactory->getErrorReporter( $this ); |
|
130 | + $this->apiErrorReporter = $apiHelperFactory->getErrorReporter($this); |
|
131 | 131 | $this->delegatingConstraintChecker = $delegatingConstraintChecker; |
132 | 132 | $this->violationMessageRenderer = $violationMessageRenderer; |
133 | 133 | $this->statementGuidParser = $statementGuidParser; |
@@ -142,39 +142,39 @@ discard block |
||
142 | 142 | $params = $this->extractRequestParams(); |
143 | 143 | $result = $this->getResult(); |
144 | 144 | |
145 | - $propertyIds = $this->parsePropertyIds( $params[self::PARAM_PROPERTY_ID] ); |
|
146 | - $constraintIds = $this->parseConstraintIds( $params[self::PARAM_CONSTRAINT_ID] ); |
|
145 | + $propertyIds = $this->parsePropertyIds($params[self::PARAM_PROPERTY_ID]); |
|
146 | + $constraintIds = $this->parseConstraintIds($params[self::PARAM_CONSTRAINT_ID]); |
|
147 | 147 | |
148 | - $this->checkPropertyIds( $propertyIds, $result ); |
|
149 | - $this->checkConstraintIds( $constraintIds, $result ); |
|
148 | + $this->checkPropertyIds($propertyIds, $result); |
|
149 | + $this->checkConstraintIds($constraintIds, $result); |
|
150 | 150 | |
151 | - $result->addValue( null, 'success', 1 ); |
|
151 | + $result->addValue(null, 'success', 1); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | /** |
155 | 155 | * @param array|null $propertyIdSerializations |
156 | 156 | * @return PropertyId[] |
157 | 157 | */ |
158 | - private function parsePropertyIds( $propertyIdSerializations ) { |
|
159 | - if ( $propertyIdSerializations === null ) { |
|
158 | + private function parsePropertyIds($propertyIdSerializations) { |
|
159 | + if ($propertyIdSerializations === null) { |
|
160 | 160 | return []; |
161 | - } elseif ( empty( $propertyIdSerializations ) ) { |
|
161 | + } elseif (empty($propertyIdSerializations)) { |
|
162 | 162 | $this->apiErrorReporter->dieError( |
163 | - 'If ' . self::PARAM_PROPERTY_ID . ' is specified, it must be nonempty.', |
|
163 | + 'If '.self::PARAM_PROPERTY_ID.' is specified, it must be nonempty.', |
|
164 | 164 | 'no-data' |
165 | 165 | ); |
166 | 166 | } |
167 | 167 | |
168 | 168 | return array_map( |
169 | - function( $propertyIdSerialization ) { |
|
169 | + function($propertyIdSerialization) { |
|
170 | 170 | try { |
171 | - return new PropertyId( $propertyIdSerialization ); |
|
172 | - } catch ( InvalidArgumentException $e ) { |
|
171 | + return new PropertyId($propertyIdSerialization); |
|
172 | + } catch (InvalidArgumentException $e) { |
|
173 | 173 | $this->apiErrorReporter->dieError( |
174 | 174 | "Invalid id: $propertyIdSerialization", |
175 | 175 | 'invalid-property-id', |
176 | 176 | 0, // default argument |
177 | - [ self::PARAM_PROPERTY_ID => $propertyIdSerialization ] |
|
177 | + [self::PARAM_PROPERTY_ID => $propertyIdSerialization] |
|
178 | 178 | ); |
179 | 179 | } |
180 | 180 | }, |
@@ -186,35 +186,35 @@ discard block |
||
186 | 186 | * @param array|null $constraintIds |
187 | 187 | * @return string[] |
188 | 188 | */ |
189 | - private function parseConstraintIds( $constraintIds ) { |
|
190 | - if ( $constraintIds === null ) { |
|
189 | + private function parseConstraintIds($constraintIds) { |
|
190 | + if ($constraintIds === null) { |
|
191 | 191 | return []; |
192 | - } elseif ( empty( $constraintIds ) ) { |
|
192 | + } elseif (empty($constraintIds)) { |
|
193 | 193 | $this->apiErrorReporter->dieError( |
194 | - 'If ' . self::PARAM_CONSTRAINT_ID . ' is specified, it must be nonempty.', |
|
194 | + 'If '.self::PARAM_CONSTRAINT_ID.' is specified, it must be nonempty.', |
|
195 | 195 | 'no-data' |
196 | 196 | ); |
197 | 197 | } |
198 | 198 | |
199 | 199 | return array_map( |
200 | - function( $constraintId ) { |
|
200 | + function($constraintId) { |
|
201 | 201 | try { |
202 | - $propertyId = $this->statementGuidParser->parse( $constraintId )->getEntityId(); |
|
203 | - if ( !$propertyId instanceof PropertyId ) { |
|
202 | + $propertyId = $this->statementGuidParser->parse($constraintId)->getEntityId(); |
|
203 | + if (!$propertyId instanceof PropertyId) { |
|
204 | 204 | $this->apiErrorReporter->dieError( |
205 | 205 | "Invalid property ID: {$propertyId->getSerialization()}", |
206 | 206 | 'invalid-property-id', |
207 | 207 | 0, // default argument |
208 | - [ self::PARAM_CONSTRAINT_ID => $constraintId ] |
|
208 | + [self::PARAM_CONSTRAINT_ID => $constraintId] |
|
209 | 209 | ); |
210 | 210 | } |
211 | 211 | return $constraintId; |
212 | - } catch ( StatementGuidParsingException $e ) { |
|
212 | + } catch (StatementGuidParsingException $e) { |
|
213 | 213 | $this->apiErrorReporter->dieError( |
214 | 214 | "Invalid statement GUID: $constraintId", |
215 | 215 | 'invalid-guid', |
216 | 216 | 0, // default argument |
217 | - [ self::PARAM_CONSTRAINT_ID => $constraintId ] |
|
217 | + [self::PARAM_CONSTRAINT_ID => $constraintId] |
|
218 | 218 | ); |
219 | 219 | } |
220 | 220 | }, |
@@ -226,12 +226,12 @@ discard block |
||
226 | 226 | * @param PropertyId[] $propertyIds |
227 | 227 | * @param ApiResult $result |
228 | 228 | */ |
229 | - private function checkPropertyIds( array $propertyIds, ApiResult $result ) { |
|
230 | - foreach ( $propertyIds as $propertyId ) { |
|
231 | - $result->addArrayType( $this->getResultPathForPropertyId( $propertyId ), 'assoc' ); |
|
232 | - $allConstraintExceptions = $this->delegatingConstraintChecker->checkConstraintParametersOnPropertyId( $propertyId ); |
|
233 | - foreach ( $allConstraintExceptions as $constraintId => $constraintParameterExceptions ) { |
|
234 | - $this->addConstraintParameterExceptionsToResult( $constraintId, $constraintParameterExceptions, $result ); |
|
229 | + private function checkPropertyIds(array $propertyIds, ApiResult $result) { |
|
230 | + foreach ($propertyIds as $propertyId) { |
|
231 | + $result->addArrayType($this->getResultPathForPropertyId($propertyId), 'assoc'); |
|
232 | + $allConstraintExceptions = $this->delegatingConstraintChecker->checkConstraintParametersOnPropertyId($propertyId); |
|
233 | + foreach ($allConstraintExceptions as $constraintId => $constraintParameterExceptions) { |
|
234 | + $this->addConstraintParameterExceptionsToResult($constraintId, $constraintParameterExceptions, $result); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | * @param string[] $constraintIds |
241 | 241 | * @param ApiResult $result |
242 | 242 | */ |
243 | - private function checkConstraintIds( array $constraintIds, ApiResult $result ) { |
|
244 | - foreach ( $constraintIds as $constraintId ) { |
|
245 | - if ( $result->getResultData( $this->getResultPathForConstraintId( $constraintId ) ) ) { |
|
243 | + private function checkConstraintIds(array $constraintIds, ApiResult $result) { |
|
244 | + foreach ($constraintIds as $constraintId) { |
|
245 | + if ($result->getResultData($this->getResultPathForConstraintId($constraintId))) { |
|
246 | 246 | // already checked as part of checkPropertyIds() |
247 | 247 | continue; |
248 | 248 | } |
249 | - $constraintParameterExceptions = $this->delegatingConstraintChecker->checkConstraintParametersOnConstraintId( $constraintId ); |
|
250 | - $this->addConstraintParameterExceptionsToResult( $constraintId, $constraintParameterExceptions, $result ); |
|
249 | + $constraintParameterExceptions = $this->delegatingConstraintChecker->checkConstraintParametersOnConstraintId($constraintId); |
|
250 | + $this->addConstraintParameterExceptionsToResult($constraintId, $constraintParameterExceptions, $result); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
@@ -255,17 +255,17 @@ discard block |
||
255 | 255 | * @param PropertyId $propertyId |
256 | 256 | * @return string[] |
257 | 257 | */ |
258 | - private function getResultPathForPropertyId( PropertyId $propertyId ) { |
|
259 | - return [ $this->getModuleName(), $propertyId->getSerialization() ]; |
|
258 | + private function getResultPathForPropertyId(PropertyId $propertyId) { |
|
259 | + return [$this->getModuleName(), $propertyId->getSerialization()]; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
263 | 263 | * @param string $constraintId |
264 | 264 | * @return string[] |
265 | 265 | */ |
266 | - private function getResultPathForConstraintId( $constraintId ) { |
|
267 | - $propertyId = $this->statementGuidParser->parse( $constraintId )->getEntityId(); |
|
268 | - return array_merge( $this->getResultPathForPropertyId( $propertyId ), [ $constraintId ] ); |
|
266 | + private function getResultPathForConstraintId($constraintId) { |
|
267 | + $propertyId = $this->statementGuidParser->parse($constraintId)->getEntityId(); |
|
268 | + return array_merge($this->getResultPathForPropertyId($propertyId), [$constraintId]); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * @param ConstraintParameterException[]|null $constraintParameterExceptions |
276 | 276 | * @param ApiResult $result |
277 | 277 | */ |
278 | - private function addConstraintParameterExceptionsToResult( $constraintId, $constraintParameterExceptions, ApiResult $result ) { |
|
279 | - $path = $this->getResultPathForConstraintId( $constraintId ); |
|
280 | - if ( $constraintParameterExceptions === null ) { |
|
278 | + private function addConstraintParameterExceptionsToResult($constraintId, $constraintParameterExceptions, ApiResult $result) { |
|
279 | + $path = $this->getResultPathForConstraintId($constraintId); |
|
280 | + if ($constraintParameterExceptions === null) { |
|
281 | 281 | $result->addValue( |
282 | 282 | $path, |
283 | 283 | self::KEY_STATUS, |
@@ -287,12 +287,12 @@ discard block |
||
287 | 287 | $result->addValue( |
288 | 288 | $path, |
289 | 289 | self::KEY_STATUS, |
290 | - empty( $constraintParameterExceptions ) ? self::STATUS_OKAY : self::STATUS_NOT_OKAY |
|
290 | + empty($constraintParameterExceptions) ? self::STATUS_OKAY : self::STATUS_NOT_OKAY |
|
291 | 291 | ); |
292 | 292 | $result->addValue( |
293 | 293 | $path, |
294 | 294 | self::KEY_PROBLEMS, |
295 | - array_map( [ $this, 'formatConstraintParameterException' ], $constraintParameterExceptions ) |
|
295 | + array_map([$this, 'formatConstraintParameterException'], $constraintParameterExceptions) |
|
296 | 296 | ); |
297 | 297 | } |
298 | 298 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * @param ConstraintParameterException $e |
304 | 304 | * @return string[] |
305 | 305 | */ |
306 | - private function formatConstraintParameterException( ConstraintParameterException $e ) { |
|
306 | + private function formatConstraintParameterException(ConstraintParameterException $e) { |
|
307 | 307 | return [ |
308 | 308 | self::KEY_MESSAGE_HTML => $this->violationMessageRenderer->render( |
309 | 309 | $e->getViolationMessage() |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return self |
81 | 81 | */ |
82 | - public static function newFromGlobalState( ApiMain $main, $name, $prefix = '' ) { |
|
82 | + public static function newFromGlobalState(ApiMain $main, $name, $prefix = '') { |
|
83 | 83 | $repo = WikibaseRepo::getDefaultInstance(); |
84 | 84 | |
85 | 85 | $language = $repo->getUserLanguage(); |
86 | 86 | $formatterOptions = new FormatterOptions(); |
87 | - $formatterOptions->setOption( SnakFormatter::OPT_LANG, $language->getCode() ); |
|
87 | + $formatterOptions->setOption(SnakFormatter::OPT_LANG, $language->getCode()); |
|
88 | 88 | $valueFormatterFactory = $repo->getValueFormatterFactory(); |
89 | - $valueFormatter = $valueFormatterFactory->getValueFormatter( SnakFormatter::FORMAT_HTML, $formatterOptions ); |
|
89 | + $valueFormatter = $valueFormatterFactory->getValueFormatter(SnakFormatter::FORMAT_HTML, $formatterOptions); |
|
90 | 90 | |
91 | 91 | $entityIdHtmlLinkFormatterFactory = $repo->getEntityIdHtmlLinkFormatterFactory(); |
92 | - $entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter( $language ); |
|
92 | + $entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter($language); |
|
93 | 93 | $entityIdLabelFormatterFactory = new EntityIdLabelFormatterFactory(); |
94 | - $entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter( $language ); |
|
94 | + $entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter($language); |
|
95 | 95 | $config = MediaWikiServices::getInstance()->getMainConfig(); |
96 | 96 | $dataFactory = MediaWikiServices::getInstance()->getStatsdDataFactory(); |
97 | 97 | $constraintReportFactory = ConstraintReportFactory::getDefaultInstance(); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $prefix, |
115 | 115 | $repo->getEntityIdParser(), |
116 | 116 | $repo->getStatementGuidValidator(), |
117 | - $repo->getApiHelperFactory( RequestContext::getMain() ), |
|
117 | + $repo->getApiHelperFactory(RequestContext::getMain()), |
|
118 | 118 | $resultsSource, |
119 | 119 | $checkResultsRenderer, |
120 | 120 | $dataFactory |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | CheckResultsRenderer $checkResultsRenderer, |
144 | 144 | IBufferingStatsdDataFactory $dataFactory |
145 | 145 | ) { |
146 | - parent::__construct( $main, $name, $prefix ); |
|
146 | + parent::__construct($main, $name, $prefix); |
|
147 | 147 | $this->entityIdParser = $entityIdParser; |
148 | 148 | $this->statementGuidValidator = $statementGuidValidator; |
149 | - $this->resultBuilder = $apiHelperFactory->getResultBuilder( $this ); |
|
150 | - $this->errorReporter = $apiHelperFactory->getErrorReporter( $this ); |
|
149 | + $this->resultBuilder = $apiHelperFactory->getResultBuilder($this); |
|
150 | + $this->errorReporter = $apiHelperFactory->getErrorReporter($this); |
|
151 | 151 | $this->resultsSource = $resultsSource; |
152 | 152 | $this->checkResultsRenderer = $checkResultsRenderer; |
153 | 153 | $this->dataFactory = $dataFactory; |
@@ -163,9 +163,9 @@ discard block |
||
163 | 163 | |
164 | 164 | $params = $this->extractRequestParams(); |
165 | 165 | |
166 | - $this->validateParameters( $params ); |
|
167 | - $entityIds = $this->parseEntityIds( $params ); |
|
168 | - $claimIds = $this->parseClaimIds( $params ); |
|
166 | + $this->validateParameters($params); |
|
167 | + $entityIds = $this->parseEntityIds($params); |
|
168 | + $claimIds = $this->parseClaimIds($params); |
|
169 | 169 | $constraintIDs = $params[self::PARAM_CONSTRAINT_ID]; |
170 | 170 | $statuses = $params[self::PARAM_STATUS]; |
171 | 171 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | ) |
182 | 182 | )->getArray() |
183 | 183 | ); |
184 | - $this->resultBuilder->markSuccess( 1 ); |
|
184 | + $this->resultBuilder->markSuccess(1); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -189,24 +189,24 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @return EntityId[] |
191 | 191 | */ |
192 | - private function parseEntityIds( array $params ) { |
|
192 | + private function parseEntityIds(array $params) { |
|
193 | 193 | $ids = $params[self::PARAM_ID]; |
194 | 194 | |
195 | - if ( $ids === null ) { |
|
195 | + if ($ids === null) { |
|
196 | 196 | return []; |
197 | - } elseif ( $ids === [] ) { |
|
197 | + } elseif ($ids === []) { |
|
198 | 198 | $this->errorReporter->dieError( |
199 | - 'If ' . self::PARAM_ID . ' is specified, it must be nonempty.', 'no-data' ); |
|
199 | + 'If '.self::PARAM_ID.' is specified, it must be nonempty.', 'no-data' ); |
|
200 | 200 | } |
201 | 201 | |
202 | - return array_map( function ( $id ) { |
|
202 | + return array_map(function($id) { |
|
203 | 203 | try { |
204 | - return $this->entityIdParser->parse( $id ); |
|
205 | - } catch ( EntityIdParsingException $e ) { |
|
204 | + return $this->entityIdParser->parse($id); |
|
205 | + } catch (EntityIdParsingException $e) { |
|
206 | 206 | $this->errorReporter->dieError( |
207 | - "Invalid id: $id", 'invalid-entity-id', 0, [ self::PARAM_ID => $id ] ); |
|
207 | + "Invalid id: $id", 'invalid-entity-id', 0, [self::PARAM_ID => $id] ); |
|
208 | 208 | } |
209 | - }, $ids ); |
|
209 | + }, $ids); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -214,35 +214,35 @@ discard block |
||
214 | 214 | * |
215 | 215 | * @return string[] |
216 | 216 | */ |
217 | - private function parseClaimIds( array $params ) { |
|
217 | + private function parseClaimIds(array $params) { |
|
218 | 218 | $ids = $params[self::PARAM_CLAIM_ID]; |
219 | 219 | |
220 | - if ( $ids === null ) { |
|
220 | + if ($ids === null) { |
|
221 | 221 | return []; |
222 | - } elseif ( $ids === [] ) { |
|
222 | + } elseif ($ids === []) { |
|
223 | 223 | $this->errorReporter->dieError( |
224 | - 'If ' . self::PARAM_CLAIM_ID . ' is specified, it must be nonempty.', 'no-data' ); |
|
224 | + 'If '.self::PARAM_CLAIM_ID.' is specified, it must be nonempty.', 'no-data' ); |
|
225 | 225 | } |
226 | 226 | |
227 | - foreach ( $ids as $id ) { |
|
228 | - if ( !$this->statementGuidValidator->validate( $id ) ) { |
|
227 | + foreach ($ids as $id) { |
|
228 | + if (!$this->statementGuidValidator->validate($id)) { |
|
229 | 229 | $this->errorReporter->dieError( |
230 | - "Invalid claim id: $id", 'invalid-guid', 0, [ self::PARAM_CLAIM_ID => $id ] ); |
|
230 | + "Invalid claim id: $id", 'invalid-guid', 0, [self::PARAM_CLAIM_ID => $id] ); |
|
231 | 231 | } |
232 | 232 | } |
233 | 233 | |
234 | 234 | return $ids; |
235 | 235 | } |
236 | 236 | |
237 | - private function validateParameters( array $params ) { |
|
238 | - if ( $params[self::PARAM_CONSTRAINT_ID] !== null |
|
239 | - && empty( $params[self::PARAM_CONSTRAINT_ID] ) |
|
237 | + private function validateParameters(array $params) { |
|
238 | + if ($params[self::PARAM_CONSTRAINT_ID] !== null |
|
239 | + && empty($params[self::PARAM_CONSTRAINT_ID]) |
|
240 | 240 | ) { |
241 | 241 | $paramConstraintId = self::PARAM_CONSTRAINT_ID; |
242 | 242 | $this->errorReporter->dieError( |
243 | 243 | "If $paramConstraintId is specified, it must be nonempty.", 'no-data' ); |
244 | 244 | } |
245 | - if ( $params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null ) { |
|
245 | + if ($params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null) { |
|
246 | 246 | $paramId = self::PARAM_ID; |
247 | 247 | $paramClaimId = self::PARAM_CLAIM_ID; |
248 | 248 | $this->errorReporter->dieError( |
@@ -282,11 +282,11 @@ discard block |
||
282 | 282 | ], |
283 | 283 | ApiBase::PARAM_ISMULTI => true, |
284 | 284 | ApiBase::PARAM_ALL => true, |
285 | - ApiBase::PARAM_DFLT => implode( '|', [ |
|
285 | + ApiBase::PARAM_DFLT => implode('|', [ |
|
286 | 286 | CheckResult::STATUS_VIOLATION, |
287 | 287 | CheckResult::STATUS_WARNING, |
288 | 288 | CheckResult::STATUS_BAD_PARAMETERS, |
289 | - ] ), |
|
289 | + ]), |
|
290 | 290 | ApiBase::PARAM_HELP_MSG_PER_VALUE => [], |
291 | 291 | ], |
292 | 292 | ]; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @codeCoverageIgnore This method is purely declarative. |
78 | 78 | */ |
79 | 79 | public function getDefaultContextTypes() { |
80 | - return [ Context::TYPE_STATEMENT ]; |
|
80 | + return [Context::TYPE_STATEMENT]; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -89,20 +89,20 @@ discard block |
||
89 | 89 | * @return CheckResult |
90 | 90 | * @throws \ConfigException |
91 | 91 | */ |
92 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
93 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
94 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
92 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
93 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
94 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
95 | 95 | } |
96 | 96 | $snak = $context->getSnak(); |
97 | - if ( !$snak instanceof PropertyValueSnak ) { |
|
97 | + if (!$snak instanceof PropertyValueSnak) { |
|
98 | 98 | // nothing to check |
99 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE ); |
|
100 | - } elseif ( $snak->getDataValue()->getType() !== 'wikibase-entityid' ) { |
|
99 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE); |
|
100 | + } elseif ($snak->getDataValue()->getType() !== 'wikibase-entityid') { |
|
101 | 101 | // wrong data type |
102 | - $message = ( new ViolationMessage( 'wbqc-violation-message-value-needed-of-type' ) ) |
|
103 | - ->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM ) |
|
104 | - ->withDataValueType( 'wikibase-entityid' ); |
|
105 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message ); |
|
102 | + $message = (new ViolationMessage('wbqc-violation-message-value-needed-of-type')) |
|
103 | + ->withEntityId(new ItemId($constraint->getConstraintTypeItemId()), Role::CONSTRAINT_TYPE_ITEM) |
|
104 | + ->withDataValueType('wikibase-entityid'); |
|
105 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message); |
|
106 | 106 | } |
107 | 107 | /** @var EntityId $subjectId */ |
108 | 108 | $subjectId = $context->getEntity()->getId(); |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | /** @var Statement[] $subjectStatements */ |
112 | 112 | $subjectStatements = $context->getEntity()->getStatements()->toArray(); |
113 | 113 | /** @var Statement[] $objectStatements */ |
114 | - $objectStatements = $this->entityLookup->getEntity( $objectId )->getStatements()->toArray(); |
|
114 | + $objectStatements = $this->entityLookup->getEntity($objectId)->getStatements()->toArray(); |
|
115 | 115 | /** @var String[] $startPropertyIds */ |
116 | - $startPropertyIds = $this->config->get( self::CONFIG_VARIABLE_START_PROPERTY_IDS ); |
|
116 | + $startPropertyIds = $this->config->get(self::CONFIG_VARIABLE_START_PROPERTY_IDS); |
|
117 | 117 | /** @var String[] $endPropertyIds */ |
118 | - $endPropertyIds = $this->config->get( self::CONFIG_VARIABLE_END_PROPERTY_IDS ); |
|
118 | + $endPropertyIds = $this->config->get(self::CONFIG_VARIABLE_END_PROPERTY_IDS); |
|
119 | 119 | $subjectStartValue = $this->getExtremeValue( |
120 | 120 | $startPropertyIds, |
121 | 121 | $subjectStatements, |
@@ -137,15 +137,15 @@ discard block |
||
137 | 137 | 'end' |
138 | 138 | ); |
139 | 139 | if ( |
140 | - $this->rangeCheckerHelper->getComparison( $subjectStartValue, $subjectEndValue ) <= 0 && |
|
141 | - $this->rangeCheckerHelper->getComparison( $objectStartValue, $objectEndValue ) <= 0 && ( |
|
142 | - $this->rangeCheckerHelper->getComparison( $subjectEndValue, $objectStartValue ) < 0 || |
|
143 | - $this->rangeCheckerHelper->getComparison( $objectEndValue, $subjectStartValue ) < 0 |
|
140 | + $this->rangeCheckerHelper->getComparison($subjectStartValue, $subjectEndValue) <= 0 && |
|
141 | + $this->rangeCheckerHelper->getComparison($objectStartValue, $objectEndValue) <= 0 && ( |
|
142 | + $this->rangeCheckerHelper->getComparison($subjectEndValue, $objectStartValue) < 0 || |
|
143 | + $this->rangeCheckerHelper->getComparison($objectEndValue, $subjectStartValue) < 0 |
|
144 | 144 | ) |
145 | 145 | ) { |
146 | 146 | if ( |
147 | 147 | $subjectEndValue == null || |
148 | - $this->rangeCheckerHelper->getComparison( $objectEndValue, $subjectEndValue ) < 0 |
|
148 | + $this->rangeCheckerHelper->getComparison($objectEndValue, $subjectEndValue) < 0 |
|
149 | 149 | ) { |
150 | 150 | $earlierEntityId = $objectId; |
151 | 151 | $minEndValue = $objectEndValue; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $message = null; |
169 | 169 | $status = CheckResult::STATUS_COMPLIANCE; |
170 | 170 | } |
171 | - return new CheckResult( $context, $constraint, [], $status, $message ); |
|
171 | + return new CheckResult($context, $constraint, [], $status, $message); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** |
@@ -178,19 +178,19 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @return DataValue|null |
180 | 180 | */ |
181 | - private function getExtremeValue( $extremePropertyIds, $statements, $startOrEnd ) { |
|
182 | - if ( $startOrEnd !== 'start' && $startOrEnd !== 'end' ) { |
|
183 | - throw new \InvalidArgumentException( '$startOrEnd must be \'start\' or \'end\'.' ); |
|
181 | + private function getExtremeValue($extremePropertyIds, $statements, $startOrEnd) { |
|
182 | + if ($startOrEnd !== 'start' && $startOrEnd !== 'end') { |
|
183 | + throw new \InvalidArgumentException('$startOrEnd must be \'start\' or \'end\'.'); |
|
184 | 184 | } |
185 | 185 | $extremeValue = null; |
186 | - foreach ( $extremePropertyIds as $extremePropertyId ) { |
|
187 | - $statementList = new StatementList( $statements ); |
|
188 | - $extremeStatements = $statementList->getByPropertyId( new PropertyId( $extremePropertyId ) ); |
|
186 | + foreach ($extremePropertyIds as $extremePropertyId) { |
|
187 | + $statementList = new StatementList($statements); |
|
188 | + $extremeStatements = $statementList->getByPropertyId(new PropertyId($extremePropertyId)); |
|
189 | 189 | /** @var Statement $extremeStatement */ |
190 | - foreach ( $extremeStatements as $extremeStatement ) { |
|
191 | - if ( $extremeStatement->getRank() !== Statement::RANK_DEPRECATED ) { |
|
190 | + foreach ($extremeStatements as $extremeStatement) { |
|
191 | + if ($extremeStatement->getRank() !== Statement::RANK_DEPRECATED) { |
|
192 | 192 | $snak = $extremeStatement->getMainSnak(); |
193 | - if ( !$snak instanceof PropertyValueSnak ) { |
|
193 | + if (!$snak instanceof PropertyValueSnak) { |
|
194 | 194 | return null; |
195 | 195 | } else { |
196 | 196 | $comparison = $this->rangeCheckerHelper->getComparison( |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | ); |
200 | 200 | if ( |
201 | 201 | $extremeValue === null || |
202 | - ( $startOrEnd === 'start' && $comparison < 0 ) || |
|
203 | - ( $startOrEnd === 'end' && $comparison > 0 ) |
|
202 | + ($startOrEnd === 'start' && $comparison < 0) || |
|
203 | + ($startOrEnd === 'end' && $comparison > 0) |
|
204 | 204 | ) { |
205 | 205 | $extremeValue = $snak->getDataValue(); |
206 | 206 | } |
@@ -230,17 +230,16 @@ discard block |
||
230 | 230 | DataValue $maxStartValue |
231 | 231 | ) { |
232 | 232 | $messageKey = $earlierEntityId === $subjectId ? |
233 | - 'wbqc-violation-message-contemporary-subject-earlier' : |
|
234 | - 'wbqc-violation-message-contemporary-value-earlier'; |
|
235 | - return ( new ViolationMessage( $messageKey ) ) |
|
236 | - ->withEntityId( $subjectId, Role::SUBJECT ) |
|
237 | - ->withEntityId( $propertyId, Role::PREDICATE ) |
|
238 | - ->withEntityId( $objectId, Role::OBJECT ) |
|
239 | - ->withDataValue( $minEndValue, Role::OBJECT ) |
|
240 | - ->withDataValue( $maxStartValue, Role::OBJECT ); |
|
233 | + 'wbqc-violation-message-contemporary-subject-earlier' : 'wbqc-violation-message-contemporary-value-earlier'; |
|
234 | + return (new ViolationMessage($messageKey)) |
|
235 | + ->withEntityId($subjectId, Role::SUBJECT) |
|
236 | + ->withEntityId($propertyId, Role::PREDICATE) |
|
237 | + ->withEntityId($objectId, Role::OBJECT) |
|
238 | + ->withDataValue($minEndValue, Role::OBJECT) |
|
239 | + ->withDataValue($maxStartValue, Role::OBJECT); |
|
241 | 240 | } |
242 | 241 | |
243 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
242 | + public function checkConstraintParameters(Constraint $constraint) { |
|
244 | 243 | // no parameters |
245 | 244 | return []; |
246 | 245 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | public static function getDefaultInstance() { |
138 | 138 | static $instance = null; |
139 | 139 | |
140 | - if ( $instance === null ) { |
|
140 | + if ($instance === null) { |
|
141 | 141 | $wikibaseRepo = WikibaseRepo::getDefaultInstance(); |
142 | 142 | $config = MediaWikiServices::getInstance()->getMainConfig(); |
143 | 143 | $titleParser = MediaWikiServices::getInstance()->getTitleParser(); |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return DelegatingConstraintChecker |
184 | 184 | */ |
185 | 185 | public function getConstraintChecker() { |
186 | - if ( $this->delegatingConstraintChecker === null ) { |
|
186 | + if ($this->delegatingConstraintChecker === null) { |
|
187 | 187 | $this->delegatingConstraintChecker = new DelegatingConstraintChecker( |
188 | 188 | $this->lookup, |
189 | 189 | $this->getConstraintCheckerMap(), |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | ConstraintsServices::getConstraintParameterParser(), |
192 | 192 | $this->statementGuidParser, |
193 | 193 | ConstraintsServices::getLoggingHelper(), |
194 | - $this->config->get( 'WBQualityConstraintsCheckQualifiers' ), |
|
195 | - $this->config->get( 'WBQualityConstraintsCheckReferences' ), |
|
196 | - $this->config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' ) |
|
194 | + $this->config->get('WBQualityConstraintsCheckQualifiers'), |
|
195 | + $this->config->get('WBQualityConstraintsCheckReferences'), |
|
196 | + $this->config->get('WBQualityConstraintsPropertiesWithViolatingQualifiers') |
|
197 | 197 | ); |
198 | 198 | } |
199 | 199 | |
@@ -204,126 +204,126 @@ discard block |
||
204 | 204 | * @return ConstraintChecker[] |
205 | 205 | */ |
206 | 206 | private function getConstraintCheckerMap() { |
207 | - if ( $this->constraintCheckerMap === null ) { |
|
207 | + if ($this->constraintCheckerMap === null) { |
|
208 | 208 | $this->constraintCheckerMap = [ |
209 | - $this->config->get( 'WBQualityConstraintsConflictsWithConstraintId' ) |
|
209 | + $this->config->get('WBQualityConstraintsConflictsWithConstraintId') |
|
210 | 210 | => new ConflictsWithChecker( |
211 | 211 | $this->lookup, |
212 | 212 | ConstraintsServices::getConstraintParameterParser(), |
213 | 213 | ConstraintsServices::getConnectionCheckerHelper() |
214 | 214 | ), |
215 | - $this->config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' ) |
|
215 | + $this->config->get('WBQualityConstraintsItemRequiresClaimConstraintId') |
|
216 | 216 | => new ItemChecker( |
217 | 217 | $this->lookup, |
218 | 218 | ConstraintsServices::getConstraintParameterParser(), |
219 | 219 | ConstraintsServices::getConnectionCheckerHelper() |
220 | 220 | ), |
221 | - $this->config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' ) |
|
221 | + $this->config->get('WBQualityConstraintsValueRequiresClaimConstraintId') |
|
222 | 222 | => new TargetRequiredClaimChecker( |
223 | 223 | $this->lookup, |
224 | 224 | ConstraintsServices::getConstraintParameterParser(), |
225 | 225 | ConstraintsServices::getConnectionCheckerHelper() |
226 | 226 | ), |
227 | - $this->config->get( 'WBQualityConstraintsSymmetricConstraintId' ) |
|
227 | + $this->config->get('WBQualityConstraintsSymmetricConstraintId') |
|
228 | 228 | => new SymmetricChecker( |
229 | 229 | $this->lookup, |
230 | 230 | ConstraintsServices::getConnectionCheckerHelper() |
231 | 231 | ), |
232 | - $this->config->get( 'WBQualityConstraintsInverseConstraintId' ) |
|
232 | + $this->config->get('WBQualityConstraintsInverseConstraintId') |
|
233 | 233 | => new InverseChecker( |
234 | 234 | $this->lookup, |
235 | 235 | ConstraintsServices::getConstraintParameterParser(), |
236 | 236 | ConstraintsServices::getConnectionCheckerHelper() |
237 | 237 | ), |
238 | - $this->config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' ) |
|
238 | + $this->config->get('WBQualityConstraintsUsedAsQualifierConstraintId') |
|
239 | 239 | => new QualifierChecker(), |
240 | - $this->config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' ) |
|
240 | + $this->config->get('WBQualityConstraintsAllowedQualifiersConstraintId') |
|
241 | 241 | => new QualifiersChecker( |
242 | 242 | ConstraintsServices::getConstraintParameterParser() |
243 | 243 | ), |
244 | - $this->config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' ) |
|
244 | + $this->config->get('WBQualityConstraintsMandatoryQualifierConstraintId') |
|
245 | 245 | => new MandatoryQualifiersChecker( |
246 | 246 | ConstraintsServices::getConstraintParameterParser() |
247 | 247 | ), |
248 | - $this->config->get( 'WBQualityConstraintsRangeConstraintId' ) |
|
248 | + $this->config->get('WBQualityConstraintsRangeConstraintId') |
|
249 | 249 | => new RangeChecker( |
250 | 250 | $this->propertyDataTypeLookup, |
251 | 251 | ConstraintsServices::getConstraintParameterParser(), |
252 | 252 | ConstraintsServices::getRangeCheckerHelper() |
253 | 253 | ), |
254 | - $this->config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' ) |
|
254 | + $this->config->get('WBQualityConstraintsDifferenceWithinRangeConstraintId') |
|
255 | 255 | => new DiffWithinRangeChecker( |
256 | 256 | ConstraintsServices::getConstraintParameterParser(), |
257 | 257 | ConstraintsServices::getRangeCheckerHelper(), |
258 | 258 | $this->config |
259 | 259 | ), |
260 | - $this->config->get( 'WBQualityConstraintsTypeConstraintId' ) |
|
260 | + $this->config->get('WBQualityConstraintsTypeConstraintId') |
|
261 | 261 | => new TypeChecker( |
262 | 262 | $this->lookup, |
263 | 263 | ConstraintsServices::getConstraintParameterParser(), |
264 | 264 | ConstraintsServices::getTypeCheckerHelper(), |
265 | 265 | $this->config |
266 | 266 | ), |
267 | - $this->config->get( 'WBQualityConstraintsValueTypeConstraintId' ) |
|
267 | + $this->config->get('WBQualityConstraintsValueTypeConstraintId') |
|
268 | 268 | => new ValueTypeChecker( |
269 | 269 | $this->lookup, |
270 | 270 | ConstraintsServices::getConstraintParameterParser(), |
271 | 271 | ConstraintsServices::getTypeCheckerHelper(), |
272 | 272 | $this->config |
273 | 273 | ), |
274 | - $this->config->get( 'WBQualityConstraintsSingleValueConstraintId' ) |
|
275 | - => new SingleValueChecker( ConstraintsServices::getConstraintParameterParser() ), |
|
276 | - $this->config->get( 'WBQualityConstraintsMultiValueConstraintId' ) |
|
277 | - => new MultiValueChecker( ConstraintsServices::getConstraintParameterParser() ), |
|
278 | - $this->config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ) |
|
274 | + $this->config->get('WBQualityConstraintsSingleValueConstraintId') |
|
275 | + => new SingleValueChecker(ConstraintsServices::getConstraintParameterParser()), |
|
276 | + $this->config->get('WBQualityConstraintsMultiValueConstraintId') |
|
277 | + => new MultiValueChecker(ConstraintsServices::getConstraintParameterParser()), |
|
278 | + $this->config->get('WBQualityConstraintsDistinctValuesConstraintId') |
|
279 | 279 | => new UniqueValueChecker( |
280 | 280 | ConstraintsServices::getSparqlHelper() |
281 | 281 | ), |
282 | - $this->config->get( 'WBQualityConstraintsFormatConstraintId' ) |
|
282 | + $this->config->get('WBQualityConstraintsFormatConstraintId') |
|
283 | 283 | => new FormatChecker( |
284 | 284 | ConstraintsServices::getConstraintParameterParser(), |
285 | 285 | $this->config, |
286 | 286 | ConstraintsServices::getSparqlHelper() |
287 | 287 | ), |
288 | - $this->config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ) |
|
288 | + $this->config->get('WBQualityConstraintsCommonsLinkConstraintId') |
|
289 | 289 | => new CommonsLinkChecker( |
290 | 290 | ConstraintsServices::getConstraintParameterParser(), |
291 | 291 | $this->titleParser |
292 | 292 | ), |
293 | - $this->config->get( 'WBQualityConstraintsOneOfConstraintId' ) |
|
293 | + $this->config->get('WBQualityConstraintsOneOfConstraintId') |
|
294 | 294 | => new OneOfChecker( |
295 | 295 | ConstraintsServices::getConstraintParameterParser() |
296 | 296 | ), |
297 | - $this->config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' ) |
|
297 | + $this->config->get('WBQualityConstraintsUsedForValuesOnlyConstraintId') |
|
298 | 298 | => new ValueOnlyChecker(), |
299 | - $this->config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' ) |
|
299 | + $this->config->get('WBQualityConstraintsUsedAsReferenceConstraintId') |
|
300 | 300 | => new ReferenceChecker(), |
301 | - $this->config->get( 'WBQualityConstraintsNoBoundsConstraintId' ) |
|
301 | + $this->config->get('WBQualityConstraintsNoBoundsConstraintId') |
|
302 | 302 | => new NoBoundsChecker(), |
303 | - $this->config->get( 'WBQualityConstraintsAllowedUnitsConstraintId' ) |
|
303 | + $this->config->get('WBQualityConstraintsAllowedUnitsConstraintId') |
|
304 | 304 | => new AllowedUnitsChecker( |
305 | 305 | ConstraintsServices::getConstraintParameterParser(), |
306 | 306 | $this->unitConverter |
307 | 307 | ), |
308 | - $this->config->get( 'WBQualityConstraintsSingleBestValueConstraintId' ) |
|
309 | - => new SingleBestValueChecker( ConstraintsServices::getConstraintParameterParser() ), |
|
310 | - $this->config->get( 'WBQualityConstraintsAllowedEntityTypesConstraintId' ) |
|
308 | + $this->config->get('WBQualityConstraintsSingleBestValueConstraintId') |
|
309 | + => new SingleBestValueChecker(ConstraintsServices::getConstraintParameterParser()), |
|
310 | + $this->config->get('WBQualityConstraintsAllowedEntityTypesConstraintId') |
|
311 | 311 | => new EntityTypeChecker( |
312 | 312 | ConstraintsServices::getConstraintParameterParser() |
313 | 313 | ), |
314 | - $this->config->get( 'WBQualityConstraintsNoneOfConstraintId' ) |
|
314 | + $this->config->get('WBQualityConstraintsNoneOfConstraintId') |
|
315 | 315 | => new NoneOfChecker( |
316 | 316 | ConstraintsServices::getConstraintParameterParser() |
317 | 317 | ), |
318 | - $this->config->get( 'WBQualityConstraintsIntegerConstraintId' ) |
|
318 | + $this->config->get('WBQualityConstraintsIntegerConstraintId') |
|
319 | 319 | => new IntegerChecker(), |
320 | - $this->config->get( 'WBQualityConstraintsCitationNeededConstraintId' ) |
|
320 | + $this->config->get('WBQualityConstraintsCitationNeededConstraintId') |
|
321 | 321 | => new CitationNeededChecker(), |
322 | - $this->config->get( 'WBQualityConstraintsPropertyScopeConstraintId' ) |
|
322 | + $this->config->get('WBQualityConstraintsPropertyScopeConstraintId') |
|
323 | 323 | => new PropertyScopeChecker( |
324 | 324 | ConstraintsServices::getConstraintParameterParser() |
325 | 325 | ), |
326 | - $this->config->get( 'WBQualityConstraintsContemporaryConstraintId' ) |
|
326 | + $this->config->get('WBQualityConstraintsContemporaryConstraintId') |
|
327 | 327 | => new ContemporaryChecker( |
328 | 328 | $this->lookup, |
329 | 329 | ConstraintsServices::getRangeCheckerHelper(), |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | * @return WikiPageEntityMetaDataAccessor |
340 | 340 | */ |
341 | 341 | public function getWikiPageEntityMetaDataAccessor() { |
342 | - if ( $this->wikiPageEntityMetaDataAccessor === null ) { |
|
342 | + if ($this->wikiPageEntityMetaDataAccessor === null) { |
|
343 | 343 | $this->wikiPageEntityMetaDataAccessor = new WikiPageEntityMetaDataLookup( |
344 | 344 | $this->entityNamespaceLookup |
345 | 345 | ); |
@@ -352,12 +352,12 @@ discard block |
||
352 | 352 | * @return ResultsSource |
353 | 353 | */ |
354 | 354 | public function getResultsSource() { |
355 | - if ( $this->resultsSource === null ) { |
|
355 | + if ($this->resultsSource === null) { |
|
356 | 356 | $this->resultsSource = new CheckingResultsSource( |
357 | 357 | $this->getConstraintChecker() |
358 | 358 | ); |
359 | 359 | |
360 | - if ( $this->config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) ) { |
|
360 | + if ($this->config->get('WBQualityConstraintsCacheCheckConstraintsResults')) { |
|
361 | 361 | $this->resultsSource = new CachingResultsSource( |
362 | 362 | $this->resultsSource, |
363 | 363 | ResultsCache::getDefaultInstance(), |
@@ -365,9 +365,9 @@ discard block |
||
365 | 365 | ConstraintsServices::getCheckResultDeserializer(), |
366 | 366 | $this->getWikiPageEntityMetaDataAccessor(), |
367 | 367 | $this->entityIdParser, |
368 | - $this->config->get( 'WBQualityConstraintsCacheCheckConstraintsTTLSeconds' ), |
|
368 | + $this->config->get('WBQualityConstraintsCacheCheckConstraintsTTLSeconds'), |
|
369 | 369 | $this->getPossiblyStaleConstraintTypes(), |
370 | - $this->config->get( 'WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds' ), |
|
370 | + $this->config->get('WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds'), |
|
371 | 371 | ConstraintsServices::getLoggingHelper() |
372 | 372 | ); |
373 | 373 | } |
@@ -381,10 +381,10 @@ discard block |
||
381 | 381 | */ |
382 | 382 | public function getPossiblyStaleConstraintTypes() { |
383 | 383 | return [ |
384 | - $this->config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ), |
|
385 | - $this->config->get( 'WBQualityConstraintsTypeConstraintId' ), |
|
386 | - $this->config->get( 'WBQualityConstraintsValueTypeConstraintId' ), |
|
387 | - $this->config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ), |
|
384 | + $this->config->get('WBQualityConstraintsCommonsLinkConstraintId'), |
|
385 | + $this->config->get('WBQualityConstraintsTypeConstraintId'), |
|
386 | + $this->config->get('WBQualityConstraintsValueTypeConstraintId'), |
|
387 | + $this->config->get('WBQualityConstraintsDistinctValuesConstraintId'), |
|
388 | 388 | ]; |
389 | 389 | } |
390 | 390 |