@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | public static function getDefaultInstance() { |
148 | 148 | static $instance = null; |
149 | 149 | |
150 | - if ( $instance === null ) { |
|
150 | + if ($instance === null) { |
|
151 | 151 | $wikibaseRepo = WikibaseRepo::getDefaultInstance(); |
152 | 152 | $config = MediaWikiServices::getInstance()->getMainConfig(); |
153 | 153 | $titleParser = MediaWikiServices::getInstance()->getTitleParser(); |
@@ -210,21 +210,21 @@ discard block |
||
210 | 210 | * @return DelegatingConstraintChecker |
211 | 211 | */ |
212 | 212 | public function getConstraintChecker() { |
213 | - if ( $this->delegatingConstraintChecker === null ) { |
|
213 | + if ($this->delegatingConstraintChecker === null) { |
|
214 | 214 | $this->delegatingConstraintChecker = new DelegatingConstraintChecker( |
215 | 215 | $this->lookup, |
216 | 216 | $this->getConstraintCheckerMap(), |
217 | - new CachingConstraintLookup( $this->getConstraintRepository() ), |
|
217 | + new CachingConstraintLookup($this->getConstraintRepository()), |
|
218 | 218 | $this->constraintParameterParser, |
219 | 219 | $this->statementGuidParser, |
220 | 220 | new LoggingHelper( |
221 | 221 | $this->dataFactory, |
222 | - LoggerFactory::getInstance( 'WikibaseQualityConstraints' ), |
|
222 | + LoggerFactory::getInstance('WikibaseQualityConstraints'), |
|
223 | 223 | $this->config |
224 | 224 | ), |
225 | - $this->config->get( 'WBQualityConstraintsCheckQualifiers' ), |
|
226 | - $this->config->get( 'WBQualityConstraintsCheckReferences' ), |
|
227 | - $this->config->get( 'WBQualityConstraintsPropertiesWithViolatingQualifiers' ) |
|
225 | + $this->config->get('WBQualityConstraintsCheckQualifiers'), |
|
226 | + $this->config->get('WBQualityConstraintsCheckReferences'), |
|
227 | + $this->config->get('WBQualityConstraintsPropertiesWithViolatingQualifiers') |
|
228 | 228 | ); |
229 | 229 | } |
230 | 230 | |
@@ -235,10 +235,10 @@ discard block |
||
235 | 235 | * @return ConstraintChecker[] |
236 | 236 | */ |
237 | 237 | private function getConstraintCheckerMap() { |
238 | - if ( $this->constraintCheckerMap === null ) { |
|
238 | + if ($this->constraintCheckerMap === null) { |
|
239 | 239 | $connectionCheckerHelper = new ConnectionCheckerHelper(); |
240 | - $rangeCheckerHelper = new RangeCheckerHelper( $this->config, $this->unitConverter ); |
|
241 | - if ( $this->config->get( 'WBQualityConstraintsSparqlEndpoint' ) !== '' ) { |
|
240 | + $rangeCheckerHelper = new RangeCheckerHelper($this->config, $this->unitConverter); |
|
241 | + if ($this->config->get('WBQualityConstraintsSparqlEndpoint') !== '') { |
|
242 | 242 | $sparqlHelper = new SparqlHelper( |
243 | 243 | $this->config, |
244 | 244 | $this->rdfVocabulary, |
@@ -260,112 +260,112 @@ discard block |
||
260 | 260 | ); |
261 | 261 | |
262 | 262 | $this->constraintCheckerMap = [ |
263 | - $this->config->get( 'WBQualityConstraintsConflictsWithConstraintId' ) |
|
263 | + $this->config->get('WBQualityConstraintsConflictsWithConstraintId') |
|
264 | 264 | => new ConflictsWithChecker( |
265 | 265 | $this->lookup, |
266 | 266 | $this->constraintParameterParser, |
267 | 267 | $connectionCheckerHelper |
268 | 268 | ), |
269 | - $this->config->get( 'WBQualityConstraintsItemRequiresClaimConstraintId' ) |
|
269 | + $this->config->get('WBQualityConstraintsItemRequiresClaimConstraintId') |
|
270 | 270 | => new ItemChecker( |
271 | 271 | $this->lookup, |
272 | 272 | $this->constraintParameterParser, |
273 | 273 | $connectionCheckerHelper |
274 | 274 | ), |
275 | - $this->config->get( 'WBQualityConstraintsValueRequiresClaimConstraintId' ) |
|
275 | + $this->config->get('WBQualityConstraintsValueRequiresClaimConstraintId') |
|
276 | 276 | => new TargetRequiredClaimChecker( |
277 | 277 | $this->lookup, |
278 | 278 | $this->constraintParameterParser, |
279 | 279 | $connectionCheckerHelper |
280 | 280 | ), |
281 | - $this->config->get( 'WBQualityConstraintsSymmetricConstraintId' ) |
|
281 | + $this->config->get('WBQualityConstraintsSymmetricConstraintId') |
|
282 | 282 | => new SymmetricChecker( |
283 | 283 | $this->lookup, |
284 | 284 | $connectionCheckerHelper |
285 | 285 | ), |
286 | - $this->config->get( 'WBQualityConstraintsInverseConstraintId' ) |
|
286 | + $this->config->get('WBQualityConstraintsInverseConstraintId') |
|
287 | 287 | => new InverseChecker( |
288 | 288 | $this->lookup, |
289 | 289 | $this->constraintParameterParser, |
290 | 290 | $connectionCheckerHelper |
291 | 291 | ), |
292 | - $this->config->get( 'WBQualityConstraintsUsedAsQualifierConstraintId' ) |
|
292 | + $this->config->get('WBQualityConstraintsUsedAsQualifierConstraintId') |
|
293 | 293 | => new QualifierChecker(), |
294 | - $this->config->get( 'WBQualityConstraintsAllowedQualifiersConstraintId' ) |
|
294 | + $this->config->get('WBQualityConstraintsAllowedQualifiersConstraintId') |
|
295 | 295 | => new QualifiersChecker( |
296 | 296 | $this->constraintParameterParser |
297 | 297 | ), |
298 | - $this->config->get( 'WBQualityConstraintsMandatoryQualifierConstraintId' ) |
|
298 | + $this->config->get('WBQualityConstraintsMandatoryQualifierConstraintId') |
|
299 | 299 | => new MandatoryQualifiersChecker( |
300 | 300 | $this->constraintParameterParser |
301 | 301 | ), |
302 | - $this->config->get( 'WBQualityConstraintsRangeConstraintId' ) |
|
302 | + $this->config->get('WBQualityConstraintsRangeConstraintId') |
|
303 | 303 | => new RangeChecker( |
304 | 304 | $this->propertyDataTypeLookup, |
305 | 305 | $this->constraintParameterParser, |
306 | 306 | $rangeCheckerHelper |
307 | 307 | ), |
308 | - $this->config->get( 'WBQualityConstraintsDifferenceWithinRangeConstraintId' ) |
|
308 | + $this->config->get('WBQualityConstraintsDifferenceWithinRangeConstraintId') |
|
309 | 309 | => new DiffWithinRangeChecker( |
310 | 310 | $this->constraintParameterParser, |
311 | 311 | $rangeCheckerHelper, |
312 | 312 | $this->config |
313 | 313 | ), |
314 | - $this->config->get( 'WBQualityConstraintsTypeConstraintId' ) |
|
314 | + $this->config->get('WBQualityConstraintsTypeConstraintId') |
|
315 | 315 | => new TypeChecker( |
316 | 316 | $this->lookup, |
317 | 317 | $this->constraintParameterParser, |
318 | 318 | $typeCheckerHelper, |
319 | 319 | $this->config |
320 | 320 | ), |
321 | - $this->config->get( 'WBQualityConstraintsValueTypeConstraintId' ) |
|
321 | + $this->config->get('WBQualityConstraintsValueTypeConstraintId') |
|
322 | 322 | => new ValueTypeChecker( |
323 | 323 | $this->lookup, |
324 | 324 | $this->constraintParameterParser, |
325 | 325 | $typeCheckerHelper, |
326 | 326 | $this->config |
327 | 327 | ), |
328 | - $this->config->get( 'WBQualityConstraintsSingleValueConstraintId' ) |
|
329 | - => new SingleValueChecker( $this->constraintParameterParser ), |
|
330 | - $this->config->get( 'WBQualityConstraintsMultiValueConstraintId' ) |
|
331 | - => new MultiValueChecker( $this->constraintParameterParser ), |
|
332 | - $this->config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ) |
|
328 | + $this->config->get('WBQualityConstraintsSingleValueConstraintId') |
|
329 | + => new SingleValueChecker($this->constraintParameterParser), |
|
330 | + $this->config->get('WBQualityConstraintsMultiValueConstraintId') |
|
331 | + => new MultiValueChecker($this->constraintParameterParser), |
|
332 | + $this->config->get('WBQualityConstraintsDistinctValuesConstraintId') |
|
333 | 333 | => new UniqueValueChecker( |
334 | 334 | $sparqlHelper |
335 | 335 | ), |
336 | - $this->config->get( 'WBQualityConstraintsFormatConstraintId' ) |
|
336 | + $this->config->get('WBQualityConstraintsFormatConstraintId') |
|
337 | 337 | => new FormatChecker( |
338 | 338 | $this->constraintParameterParser, |
339 | 339 | $this->config, |
340 | 340 | $sparqlHelper |
341 | 341 | ), |
342 | - $this->config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ) |
|
342 | + $this->config->get('WBQualityConstraintsCommonsLinkConstraintId') |
|
343 | 343 | => new CommonsLinkChecker( |
344 | 344 | $this->constraintParameterParser, |
345 | 345 | $this->titleParser |
346 | 346 | ), |
347 | - $this->config->get( 'WBQualityConstraintsOneOfConstraintId' ) |
|
347 | + $this->config->get('WBQualityConstraintsOneOfConstraintId') |
|
348 | 348 | => new OneOfChecker( |
349 | 349 | $this->constraintParameterParser |
350 | 350 | ), |
351 | - $this->config->get( 'WBQualityConstraintsUsedForValuesOnlyConstraintId' ) |
|
351 | + $this->config->get('WBQualityConstraintsUsedForValuesOnlyConstraintId') |
|
352 | 352 | => new ValueOnlyChecker(), |
353 | - $this->config->get( 'WBQualityConstraintsUsedAsReferenceConstraintId' ) |
|
353 | + $this->config->get('WBQualityConstraintsUsedAsReferenceConstraintId') |
|
354 | 354 | => new ReferenceChecker(), |
355 | - $this->config->get( 'WBQualityConstraintsNoBoundsConstraintId' ) |
|
355 | + $this->config->get('WBQualityConstraintsNoBoundsConstraintId') |
|
356 | 356 | => new NoBoundsChecker(), |
357 | - $this->config->get( 'WBQualityConstraintsAllowedUnitsConstraintId' ) |
|
357 | + $this->config->get('WBQualityConstraintsAllowedUnitsConstraintId') |
|
358 | 358 | => new AllowedUnitsChecker( |
359 | 359 | $this->constraintParameterParser, |
360 | 360 | $this->unitConverter |
361 | 361 | ), |
362 | - $this->config->get( 'WBQualityConstraintsSingleBestValueConstraintId' ) |
|
363 | - => new SingleBestValueChecker( $this->constraintParameterParser ), |
|
364 | - $this->config->get( 'WBQualityConstraintsAllowedEntityTypesConstraintId' ) |
|
362 | + $this->config->get('WBQualityConstraintsSingleBestValueConstraintId') |
|
363 | + => new SingleBestValueChecker($this->constraintParameterParser), |
|
364 | + $this->config->get('WBQualityConstraintsAllowedEntityTypesConstraintId') |
|
365 | 365 | => new EntityTypeChecker( |
366 | 366 | $this->constraintParameterParser |
367 | 367 | ), |
368 | - $this->config->get( 'WBQualityConstraintsNoneOfConstraintId' ) |
|
368 | + $this->config->get('WBQualityConstraintsNoneOfConstraintId') |
|
369 | 369 | => new NoneOfChecker( |
370 | 370 | $this->constraintParameterParser |
371 | 371 | ), |
@@ -379,26 +379,26 @@ discard block |
||
379 | 379 | * @return array[] |
380 | 380 | */ |
381 | 381 | public function getConstraintParameterMap() { |
382 | - if ( $this->constraintParameterMap === null ) { |
|
382 | + if ($this->constraintParameterMap === null) { |
|
383 | 383 | $this->constraintParameterMap = [ |
384 | - 'Commons link' => [ 'namespace' ], |
|
385 | - 'Conflicts with' => [ 'property', 'item' ], |
|
386 | - 'Diff within range' => [ 'property', 'minimum_quantity', 'maximum_quantity' ], |
|
387 | - 'Format' => [ 'pattern' ], |
|
388 | - 'Inverse' => [ 'property' ], |
|
389 | - 'Item' => [ 'property', 'item' ], |
|
390 | - 'Mandatory qualifiers' => [ 'property' ], |
|
384 | + 'Commons link' => ['namespace'], |
|
385 | + 'Conflicts with' => ['property', 'item'], |
|
386 | + 'Diff within range' => ['property', 'minimum_quantity', 'maximum_quantity'], |
|
387 | + 'Format' => ['pattern'], |
|
388 | + 'Inverse' => ['property'], |
|
389 | + 'Item' => ['property', 'item'], |
|
390 | + 'Mandatory qualifiers' => ['property'], |
|
391 | 391 | 'Multi value' => [], |
392 | - 'One of' => [ 'item' ], |
|
392 | + 'One of' => ['item'], |
|
393 | 393 | 'Qualifier' => [], |
394 | - 'Qualifiers' => [ 'property' ], |
|
395 | - 'Range' => [ 'minimum_quantity', 'maximum_quantity', 'minimum_date', 'maximum_date' ], |
|
394 | + 'Qualifiers' => ['property'], |
|
395 | + 'Range' => ['minimum_quantity', 'maximum_quantity', 'minimum_date', 'maximum_date'], |
|
396 | 396 | 'Single value' => [], |
397 | 397 | 'Symmetric' => [], |
398 | - 'Target required claim' => [ 'property', 'item' ], |
|
399 | - 'Type' => [ 'class', 'relation' ], |
|
398 | + 'Target required claim' => ['property', 'item'], |
|
399 | + 'Type' => ['class', 'relation'], |
|
400 | 400 | 'Unique value' => [], |
401 | - 'Value type' => [ 'class', 'relation' ] |
|
401 | + 'Value type' => ['class', 'relation'] |
|
402 | 402 | ]; |
403 | 403 | } |
404 | 404 | |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | * @return ConstraintRepository |
410 | 410 | */ |
411 | 411 | public function getConstraintRepository() { |
412 | - if ( $this->constraintRepository === null ) { |
|
412 | + if ($this->constraintRepository === null) { |
|
413 | 413 | $this->constraintRepository = new ConstraintRepository(); |
414 | 414 | } |
415 | 415 |
@@ -91,28 +91,28 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return self |
93 | 93 | */ |
94 | - public static function newFromGlobalState( ApiMain $main, $name, $prefix = '' ) { |
|
94 | + public static function newFromGlobalState(ApiMain $main, $name, $prefix = '') { |
|
95 | 95 | $repo = WikibaseRepo::getDefaultInstance(); |
96 | 96 | |
97 | 97 | $language = $repo->getUserLanguage(); |
98 | 98 | $formatterOptions = new FormatterOptions(); |
99 | - $formatterOptions->setOption( SnakFormatter::OPT_LANG, $language->getCode() ); |
|
99 | + $formatterOptions->setOption(SnakFormatter::OPT_LANG, $language->getCode()); |
|
100 | 100 | $valueFormatterFactory = $repo->getValueFormatterFactory(); |
101 | - $valueFormatter = $valueFormatterFactory->getValueFormatter( SnakFormatter::FORMAT_HTML, $formatterOptions ); |
|
101 | + $valueFormatter = $valueFormatterFactory->getValueFormatter(SnakFormatter::FORMAT_HTML, $formatterOptions); |
|
102 | 102 | |
103 | 103 | $languageFallbackLabelDescriptionLookupFactory = $repo->getLanguageFallbackLabelDescriptionLookupFactory(); |
104 | - $labelDescriptionLookup = $languageFallbackLabelDescriptionLookupFactory->newLabelDescriptionLookup( $language ); |
|
104 | + $labelDescriptionLookup = $languageFallbackLabelDescriptionLookupFactory->newLabelDescriptionLookup($language); |
|
105 | 105 | $entityIdHtmlLinkFormatterFactory = $repo->getEntityIdHtmlLinkFormatterFactory(); |
106 | - $entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter( $labelDescriptionLookup ); |
|
106 | + $entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter($labelDescriptionLookup); |
|
107 | 107 | $entityIdLabelFormatterFactory = new EntityIdLabelFormatterFactory(); |
108 | - $entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter( $labelDescriptionLookup ); |
|
108 | + $entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter($labelDescriptionLookup); |
|
109 | 109 | $config = MediaWikiServices::getInstance()->getMainConfig(); |
110 | 110 | $titleParser = MediaWikiServices::getInstance()->getTitleParser(); |
111 | 111 | $unitConverter = $repo->getUnitConverter(); |
112 | 112 | $dataFactory = MediaWikiServices::getInstance()->getStatsdDataFactory(); |
113 | 113 | $loggingHelper = new LoggingHelper( |
114 | 114 | $dataFactory, |
115 | - LoggerFactory::getInstance( 'WikibaseQualityConstraints' ), |
|
115 | + LoggerFactory::getInstance('WikibaseQualityConstraints'), |
|
116 | 116 | $config |
117 | 117 | ); |
118 | 118 | $constraintReportFactory = new ConstraintReportFactory( |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $resultsSource = new CheckingResultsSource( |
152 | 152 | $constraintReportFactory->getConstraintChecker() |
153 | 153 | ); |
154 | - if ( $config->get( 'WBQualityConstraintsCacheCheckConstraintsResults' ) ) { |
|
154 | + if ($config->get('WBQualityConstraintsCacheCheckConstraintsResults')) { |
|
155 | 155 | $wikiPageEntityMetaDataAccessor = new WikiPageEntityMetaDataLookup( |
156 | 156 | $repo->getEntityNamespaceLookup() |
157 | 157 | ); |
@@ -180,14 +180,14 @@ discard block |
||
180 | 180 | $checkResultDeserializer, |
181 | 181 | $wikiPageEntityMetaDataAccessor, |
182 | 182 | $entityIdParser, |
183 | - $config->get( 'WBQualityConstraintsCacheCheckConstraintsTTLSeconds' ), |
|
183 | + $config->get('WBQualityConstraintsCacheCheckConstraintsTTLSeconds'), |
|
184 | 184 | [ |
185 | - $config->get( 'WBQualityConstraintsCommonsLinkConstraintId' ), |
|
186 | - $config->get( 'WBQualityConstraintsTypeConstraintId' ), |
|
187 | - $config->get( 'WBQualityConstraintsValueTypeConstraintId' ), |
|
188 | - $config->get( 'WBQualityConstraintsDistinctValuesConstraintId' ), |
|
185 | + $config->get('WBQualityConstraintsCommonsLinkConstraintId'), |
|
186 | + $config->get('WBQualityConstraintsTypeConstraintId'), |
|
187 | + $config->get('WBQualityConstraintsValueTypeConstraintId'), |
|
188 | + $config->get('WBQualityConstraintsDistinctValuesConstraintId'), |
|
189 | 189 | ], |
190 | - $config->get( 'WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds' ), |
|
190 | + $config->get('WBQualityConstraintsCacheCheckConstraintsMaximumRevisionIds'), |
|
191 | 191 | $loggingHelper |
192 | 192 | ); |
193 | 193 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $prefix, |
199 | 199 | $repo->getEntityIdParser(), |
200 | 200 | $repo->getStatementGuidValidator(), |
201 | - $repo->getApiHelperFactory( RequestContext::getMain() ), |
|
201 | + $repo->getApiHelperFactory(RequestContext::getMain()), |
|
202 | 202 | $resultsSource, |
203 | 203 | $checkResultsRenderer, |
204 | 204 | $dataFactory |
@@ -227,11 +227,11 @@ discard block |
||
227 | 227 | CheckResultsRenderer $checkResultsRenderer, |
228 | 228 | IBufferingStatsdDataFactory $dataFactory |
229 | 229 | ) { |
230 | - parent::__construct( $main, $name, $prefix ); |
|
230 | + parent::__construct($main, $name, $prefix); |
|
231 | 231 | $this->entityIdParser = $entityIdParser; |
232 | 232 | $this->statementGuidValidator = $statementGuidValidator; |
233 | - $this->resultBuilder = $apiHelperFactory->getResultBuilder( $this ); |
|
234 | - $this->errorReporter = $apiHelperFactory->getErrorReporter( $this ); |
|
233 | + $this->resultBuilder = $apiHelperFactory->getResultBuilder($this); |
|
234 | + $this->errorReporter = $apiHelperFactory->getErrorReporter($this); |
|
235 | 235 | $this->resultsSource = $resultsSource; |
236 | 236 | $this->checkResultsRenderer = $checkResultsRenderer; |
237 | 237 | $this->dataFactory = $dataFactory; |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | |
248 | 248 | $params = $this->extractRequestParams(); |
249 | 249 | |
250 | - $this->validateParameters( $params ); |
|
251 | - $entityIds = $this->parseEntityIds( $params ); |
|
252 | - $claimIds = $this->parseClaimIds( $params ); |
|
250 | + $this->validateParameters($params); |
|
251 | + $entityIds = $this->parseEntityIds($params); |
|
252 | + $claimIds = $this->parseClaimIds($params); |
|
253 | 253 | $constraintIDs = $params[self::PARAM_CONSTRAINT_ID]; |
254 | 254 | $statuses = $params[self::PARAM_STATUS]; |
255 | 255 | |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | ) |
266 | 266 | )->getArray() |
267 | 267 | ); |
268 | - $this->resultBuilder->markSuccess( 1 ); |
|
268 | + $this->resultBuilder->markSuccess(1); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -273,24 +273,24 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return EntityId[] |
275 | 275 | */ |
276 | - private function parseEntityIds( array $params ) { |
|
276 | + private function parseEntityIds(array $params) { |
|
277 | 277 | $ids = $params[self::PARAM_ID]; |
278 | 278 | |
279 | - if ( $ids === null ) { |
|
279 | + if ($ids === null) { |
|
280 | 280 | return []; |
281 | - } elseif ( $ids === [] ) { |
|
281 | + } elseif ($ids === []) { |
|
282 | 282 | $this->errorReporter->dieError( |
283 | - 'If ' . self::PARAM_ID . ' is specified, it must be nonempty.', 'no-data' ); |
|
283 | + 'If '.self::PARAM_ID.' is specified, it must be nonempty.', 'no-data' ); |
|
284 | 284 | } |
285 | 285 | |
286 | - return array_map( function ( $id ) { |
|
286 | + return array_map(function($id) { |
|
287 | 287 | try { |
288 | - return $this->entityIdParser->parse( $id ); |
|
289 | - } catch ( EntityIdParsingException $e ) { |
|
288 | + return $this->entityIdParser->parse($id); |
|
289 | + } catch (EntityIdParsingException $e) { |
|
290 | 290 | $this->errorReporter->dieError( |
291 | - "Invalid id: $id", 'invalid-entity-id', 0, [ self::PARAM_ID => $id ] ); |
|
291 | + "Invalid id: $id", 'invalid-entity-id', 0, [self::PARAM_ID => $id] ); |
|
292 | 292 | } |
293 | - }, $ids ); |
|
293 | + }, $ids); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -298,35 +298,35 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @return string[] |
300 | 300 | */ |
301 | - private function parseClaimIds( array $params ) { |
|
301 | + private function parseClaimIds(array $params) { |
|
302 | 302 | $ids = $params[self::PARAM_CLAIM_ID]; |
303 | 303 | |
304 | - if ( $ids === null ) { |
|
304 | + if ($ids === null) { |
|
305 | 305 | return []; |
306 | - } elseif ( $ids === [] ) { |
|
306 | + } elseif ($ids === []) { |
|
307 | 307 | $this->errorReporter->dieError( |
308 | - 'If ' . self::PARAM_CLAIM_ID . ' is specified, it must be nonempty.', 'no-data' ); |
|
308 | + 'If '.self::PARAM_CLAIM_ID.' is specified, it must be nonempty.', 'no-data' ); |
|
309 | 309 | } |
310 | 310 | |
311 | - foreach ( $ids as $id ) { |
|
312 | - if ( !$this->statementGuidValidator->validate( $id ) ) { |
|
311 | + foreach ($ids as $id) { |
|
312 | + if (!$this->statementGuidValidator->validate($id)) { |
|
313 | 313 | $this->errorReporter->dieError( |
314 | - "Invalid claim id: $id", 'invalid-guid', 0, [ self::PARAM_CLAIM_ID => $id ] ); |
|
314 | + "Invalid claim id: $id", 'invalid-guid', 0, [self::PARAM_CLAIM_ID => $id] ); |
|
315 | 315 | } |
316 | 316 | } |
317 | 317 | |
318 | 318 | return $ids; |
319 | 319 | } |
320 | 320 | |
321 | - private function validateParameters( array $params ) { |
|
322 | - if ( $params[self::PARAM_CONSTRAINT_ID] !== null |
|
323 | - && empty( $params[self::PARAM_CONSTRAINT_ID] ) |
|
321 | + private function validateParameters(array $params) { |
|
322 | + if ($params[self::PARAM_CONSTRAINT_ID] !== null |
|
323 | + && empty($params[self::PARAM_CONSTRAINT_ID]) |
|
324 | 324 | ) { |
325 | 325 | $paramConstraintId = self::PARAM_CONSTRAINT_ID; |
326 | 326 | $this->errorReporter->dieError( |
327 | 327 | "If $paramConstraintId is specified, it must be nonempty.", 'no-data' ); |
328 | 328 | } |
329 | - if ( $params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null ) { |
|
329 | + if ($params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null) { |
|
330 | 330 | $paramId = self::PARAM_ID; |
331 | 331 | $paramClaimId = self::PARAM_CLAIM_ID; |
332 | 332 | $this->errorReporter->dieError( |
@@ -366,11 +366,11 @@ discard block |
||
366 | 366 | ], |
367 | 367 | ApiBase::PARAM_ISMULTI => true, |
368 | 368 | ApiBase::PARAM_ALL => true, |
369 | - ApiBase::PARAM_DFLT => implode( '|', [ |
|
369 | + ApiBase::PARAM_DFLT => implode('|', [ |
|
370 | 370 | CheckResult::STATUS_VIOLATION, |
371 | 371 | CheckResult::STATUS_WARNING, |
372 | 372 | CheckResult::STATUS_BAD_PARAMETERS, |
373 | - ] ), |
|
373 | + ]), |
|
374 | 374 | ApiBase::PARAM_HELP_MSG_PER_VALUE => [], |
375 | 375 | ], |
376 | 376 | ]; |