@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param ItemId $itemId |
| 45 | 45 | * @return self |
| 46 | 46 | */ |
| 47 | - public static function fromItemId( ItemId $itemId ) { |
|
| 47 | + public static function fromItemId(ItemId $itemId) { |
|
| 48 | 48 | $ret = new self; |
| 49 | 49 | $ret->itemId = $itemId; |
| 50 | 50 | return $ret; |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | * @throws InvalidArgumentException |
| 81 | 81 | * @return self |
| 82 | 82 | */ |
| 83 | - public static function fromSnak( Snak $snak ) { |
|
| 84 | - switch ( true ) { |
|
| 83 | + public static function fromSnak(Snak $snak) { |
|
| 84 | + switch (true) { |
|
| 85 | 85 | case $snak instanceof PropertyValueSnak: |
| 86 | 86 | $dataValue = $snak->getDataValue(); |
| 87 | - if ( $dataValue instanceof EntityIdValue |
|
| 87 | + if ($dataValue instanceof EntityIdValue |
|
| 88 | 88 | && $dataValue->getEntityId() instanceof ItemId |
| 89 | 89 | ) { |
| 90 | - return self::fromItemId( $dataValue->getEntityId() ); |
|
| 90 | + return self::fromItemId($dataValue->getEntityId()); |
|
| 91 | 91 | } |
| 92 | 92 | break; |
| 93 | 93 | case $snak instanceof PropertySomeValueSnak: |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | return self::noValue(); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - throw new InvalidArgumentException( 'Snak must contain item ID value or be a somevalue / novalue snak' ); |
|
| 99 | + throw new InvalidArgumentException('Snak must contain item ID value or be a somevalue / novalue snak'); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | * @return ItemId |
| 134 | 134 | */ |
| 135 | 135 | public function getItemId() { |
| 136 | - if ( ! $this->isValue() ) { |
|
| 137 | - throw new DomainException( 'This value does not contain an item ID.' ); |
|
| 136 | + if (!$this->isValue()) { |
|
| 137 | + throw new DomainException('This value does not contain an item ID.'); |
|
| 138 | 138 | } |
| 139 | 139 | return $this->itemId; |
| 140 | 140 | } |
@@ -146,13 +146,13 @@ discard block |
||
| 146 | 146 | * @param Snak $snak |
| 147 | 147 | * @return bool |
| 148 | 148 | */ |
| 149 | - public function matchesSnak( Snak $snak ) { |
|
| 150 | - switch ( true ) { |
|
| 149 | + public function matchesSnak(Snak $snak) { |
|
| 150 | + switch (true) { |
|
| 151 | 151 | case $snak instanceof PropertyValueSnak: |
| 152 | 152 | return $this->isValue() && |
| 153 | 153 | $snak->getDataValue() instanceof EntityIdValue && |
| 154 | 154 | $snak->getDataValue()->getEntityId() instanceof ItemId && |
| 155 | - $snak->getDataValue()->getEntityId()->equals( $this->getItemId() ); |
|
| 155 | + $snak->getDataValue()->getEntityId()->equals($this->getItemId()); |
|
| 156 | 156 | case $snak instanceof PropertySomeValueSnak: |
| 157 | 157 | return $this->isSomeValue(); |
| 158 | 158 | case $snak instanceof PropertyNoValueSnak: |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | StatementList $statementList, |
| 31 | 31 | PropertyId $propertyId |
| 32 | 32 | ) { |
| 33 | - $statementListByPropertyId = $statementList->getByPropertyId( $propertyId ); |
|
| 34 | - if ( $statementListByPropertyId->isEmpty() ) { |
|
| 33 | + $statementListByPropertyId = $statementList->getByPropertyId($propertyId); |
|
| 34 | + if ($statementListByPropertyId->isEmpty()) { |
|
| 35 | 35 | return null; |
| 36 | 36 | } else { |
| 37 | 37 | return $statementListByPropertyId->toArray()[0]; |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | PropertyId $propertyId, |
| 53 | 53 | EntityId $value |
| 54 | 54 | ) { |
| 55 | - $statementListByPropertyId = $statementList->getByPropertyId( $propertyId ); |
|
| 55 | + $statementListByPropertyId = $statementList->getByPropertyId($propertyId); |
|
| 56 | 56 | /** @var Statement $statement */ |
| 57 | - foreach ( $statementListByPropertyId as $statement ) { |
|
| 57 | + foreach ($statementListByPropertyId as $statement) { |
|
| 58 | 58 | $snak = $statement->getMainSnak(); |
| 59 | - if ( $snak instanceof PropertyValueSnak ) { |
|
| 59 | + if ($snak instanceof PropertyValueSnak) { |
|
| 60 | 60 | $dataValue = $snak->getDataValue(); |
| 61 | - if ( $dataValue instanceof EntityIdValue && |
|
| 62 | - $dataValue->getEntityId()->equals( $value ) |
|
| 61 | + if ($dataValue instanceof EntityIdValue && |
|
| 62 | + $dataValue->getEntityId()->equals($value) |
|
| 63 | 63 | ) { |
| 64 | 64 | return $statement; |
| 65 | 65 | } |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | PropertyId $propertyId, |
| 83 | 83 | array $values |
| 84 | 84 | ) { |
| 85 | - $statementListByPropertyId = $statementList->getByPropertyId( $propertyId ); |
|
| 85 | + $statementListByPropertyId = $statementList->getByPropertyId($propertyId); |
|
| 86 | 86 | /** @var Statement $statement */ |
| 87 | - foreach ( $statementListByPropertyId as $statement ) { |
|
| 87 | + foreach ($statementListByPropertyId as $statement) { |
|
| 88 | 88 | $snak = $statement->getMainSnak(); |
| 89 | - foreach ( $values as $value ) { |
|
| 90 | - if ( $value->matchesSnak( $snak ) ) { |
|
| 89 | + foreach ($values as $value) { |
|
| 90 | + if ($value->matchesSnak($snak)) { |
|
| 91 | 91 | return $statement; |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | const BATCH_SIZE = 10; |
| 28 | 28 | |
| 29 | - public static function newFromGlobalState( Title $title, array $params ) { |
|
| 30 | - Assert::parameterType( 'string', $params['propertyId'], '$params["propertyId"]' ); |
|
| 29 | + public static function newFromGlobalState(Title $title, array $params) { |
|
| 30 | + Assert::parameterType('string', $params['propertyId'], '$params["propertyId"]'); |
|
| 31 | 31 | $repo = WikibaseRepo::getDefaultInstance(); |
| 32 | 32 | return new UpdateConstraintsTableJob( |
| 33 | 33 | $title, |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | EntityLookup $entityLookup, |
| 84 | 84 | Serializer $snakSerializer |
| 85 | 85 | ) { |
| 86 | - parent::__construct( 'constraintsTableUpdate', $title, $params ); |
|
| 86 | + parent::__construct('constraintsTableUpdate', $title, $params); |
|
| 87 | 87 | |
| 88 | 88 | $this->propertyId = $propertyId; |
| 89 | 89 | $this->config = $config; |
@@ -92,11 +92,11 @@ discard block |
||
| 92 | 92 | $this->snakSerializer = $snakSerializer; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public function extractParametersFromQualifiers( SnakList $qualifiers ) { |
|
| 95 | + public function extractParametersFromQualifiers(SnakList $qualifiers) { |
|
| 96 | 96 | $parameters = []; |
| 97 | - foreach ( $qualifiers as $qualifier ) { |
|
| 97 | + foreach ($qualifiers as $qualifier) { |
|
| 98 | 98 | $qualifierId = $qualifier->getPropertyId()->getSerialization(); |
| 99 | - $paramSerialization = $this->snakSerializer->serialize( $qualifier ); |
|
| 99 | + $paramSerialization = $this->snakSerializer->serialize($qualifier); |
|
| 100 | 100 | $parameters[$qualifierId][] = $paramSerialization; |
| 101 | 101 | } |
| 102 | 102 | return $parameters; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | ) { |
| 109 | 109 | $constraintId = $constraintStatement->getGuid(); |
| 110 | 110 | $constraintTypeQid = $constraintStatement->getMainSnak()->getDataValue()->getEntityId()->getSerialization(); |
| 111 | - $parameters = $this->extractParametersFromQualifiers( $constraintStatement->getQualifiers() ); |
|
| 111 | + $parameters = $this->extractParametersFromQualifiers($constraintStatement->getQualifiers()); |
|
| 112 | 112 | return new Constraint( |
| 113 | 113 | $constraintId, |
| 114 | 114 | $propertyId, |
@@ -123,17 +123,17 @@ discard block |
||
| 123 | 123 | PropertyId $propertyConstraintPropertyId |
| 124 | 124 | ) { |
| 125 | 125 | $constraintsStatements = $property->getStatements() |
| 126 | - ->getByPropertyId( $propertyConstraintPropertyId ) |
|
| 127 | - ->getByRank( [ Statement::RANK_PREFERRED, Statement::RANK_NORMAL ] ); |
|
| 126 | + ->getByPropertyId($propertyConstraintPropertyId) |
|
| 127 | + ->getByRank([Statement::RANK_PREFERRED, Statement::RANK_NORMAL]); |
|
| 128 | 128 | $constraints = []; |
| 129 | - foreach ( $constraintsStatements->getIterator() as $constraintStatement ) { |
|
| 130 | - $constraints[] = $this->extractConstraintFromStatement( $property->getId(), $constraintStatement ); |
|
| 131 | - if ( count( $constraints ) >= self::BATCH_SIZE ) { |
|
| 132 | - $constraintRepo->insertBatch( $constraints ); |
|
| 129 | + foreach ($constraintsStatements->getIterator() as $constraintStatement) { |
|
| 130 | + $constraints[] = $this->extractConstraintFromStatement($property->getId(), $constraintStatement); |
|
| 131 | + if (count($constraints) >= self::BATCH_SIZE) { |
|
| 132 | + $constraintRepo->insertBatch($constraints); |
|
| 133 | 133 | $constraints = []; |
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | - $constraintRepo->insertBatch( $constraints ); |
|
| 136 | + $constraintRepo->insertBatch($constraints); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | /** |
@@ -144,15 +144,15 @@ discard block |
||
| 144 | 144 | public function run() { |
| 145 | 145 | // TODO in the future: only touch constraints affected by the edit (requires T163465) |
| 146 | 146 | |
| 147 | - $propertyId = new PropertyId( $this->propertyId ); |
|
| 148 | - $this->constraintRepo->deleteForPropertyWhereConstraintIdIsStatementId( $propertyId ); |
|
| 147 | + $propertyId = new PropertyId($this->propertyId); |
|
| 148 | + $this->constraintRepo->deleteForPropertyWhereConstraintIdIsStatementId($propertyId); |
|
| 149 | 149 | |
| 150 | 150 | /** @var Property $property */ |
| 151 | - $property = $this->entityLookup->getEntity( $propertyId ); |
|
| 151 | + $property = $this->entityLookup->getEntity($propertyId); |
|
| 152 | 152 | $this->importConstraintsForProperty( |
| 153 | 153 | $property, |
| 154 | 154 | $this->constraintRepo, |
| 155 | - new PropertyId( $this->config->get( 'WBQualityConstraintsPropertyConstraintId' ) ) |
|
| 155 | + new PropertyId($this->config->get('WBQualityConstraintsPropertyConstraintId')) |
|
| 156 | 156 | ); |
| 157 | 157 | |
| 158 | 158 | return true; |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | protected $snak; |
| 25 | 25 | |
| 26 | - public function __construct( EntityDocument $entity, Snak $snak ) { |
|
| 26 | + public function __construct(EntityDocument $entity, Snak $snak) { |
|
| 27 | 27 | $this->entity = $entity; |
| 28 | 28 | $this->snak = $snak; |
| 29 | 29 | } |
@@ -20,13 +20,13 @@ |
||
| 20 | 20 | * @param PropertyId $propertyId |
| 21 | 21 | * @return int |
| 22 | 22 | */ |
| 23 | - public function getPropertyCount( array $snaks, PropertyId $propertyId ) { |
|
| 24 | - return count( array_filter( |
|
| 23 | + public function getPropertyCount(array $snaks, PropertyId $propertyId) { |
|
| 24 | + return count(array_filter( |
|
| 25 | 25 | $snaks, |
| 26 | - function ( Snak $snak ) use ( $propertyId ) { |
|
| 27 | - return $snak->getPropertyId()->equals( $propertyId ); |
|
| 26 | + function(Snak $snak) use ($propertyId) { |
|
| 27 | + return $snak->getPropertyId()->equals($propertyId); |
|
| 28 | 28 | } |
| 29 | - ) ); |
|
| 29 | + )); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | } |
@@ -9,10 +9,10 @@ discard block |
||
| 9 | 9 | use Wikibase\Repo\WikibaseRepo; |
| 10 | 10 | |
| 11 | 11 | // @codeCoverageIgnoreStart |
| 12 | -$basePath = getenv( "MW_INSTALL_PATH" ) !== false |
|
| 13 | - ? getenv( "MW_INSTALL_PATH" ) : __DIR__ . "/../../.."; |
|
| 12 | +$basePath = getenv("MW_INSTALL_PATH") !== false |
|
| 13 | + ? getenv("MW_INSTALL_PATH") : __DIR__."/../../.."; |
|
| 14 | 14 | |
| 15 | -require_once $basePath . "/maintenance/Maintenance.php"; |
|
| 15 | +require_once $basePath."/maintenance/Maintenance.php"; |
|
| 16 | 16 | // @codeCoverageIgnoreEnd |
| 17 | 17 | |
| 18 | 18 | /** |
@@ -38,31 +38,31 @@ discard block |
||
| 38 | 38 | parent::__construct(); |
| 39 | 39 | $repo = WikibaseRepo::getDefaultInstance(); |
| 40 | 40 | $this->propertyInfoLookup = $repo->getStore()->getPropertyInfoLookup(); |
| 41 | - $this->newUpdateConstraintsTableJob = function ( $propertyIdSerialization ) { |
|
| 41 | + $this->newUpdateConstraintsTableJob = function($propertyIdSerialization) { |
|
| 42 | 42 | return UpdateConstraintsTableJob::newFromGlobalState( |
| 43 | 43 | Title::newMainPage(), |
| 44 | - [ 'propertyId' => $propertyIdSerialization ] |
|
| 44 | + ['propertyId' => $propertyIdSerialization] |
|
| 45 | 45 | ); |
| 46 | 46 | }; |
| 47 | 47 | |
| 48 | - $this->addDescription( 'Imports property constraints from statements on properties' ); |
|
| 49 | - $this->requireExtension( 'WikibaseQualityConstraints' ); |
|
| 48 | + $this->addDescription('Imports property constraints from statements on properties'); |
|
| 49 | + $this->requireExtension('WikibaseQualityConstraints'); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function execute() { |
| 53 | - if ( !$this->getConfig()->get( 'WBQualityConstraintsEnableConstraintsImportFromStatements' ) ) { |
|
| 54 | - $this->error( 'Constraint statements are not enabled. Aborting.' ); |
|
| 53 | + if (!$this->getConfig()->get('WBQualityConstraintsEnableConstraintsImportFromStatements')) { |
|
| 54 | + $this->error('Constraint statements are not enabled. Aborting.'); |
|
| 55 | 55 | return; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - foreach ( $this->propertyInfoLookup->getAllPropertyInfo() as $propertyIdSerialization => $info ) { |
|
| 59 | - $this->output( sprintf( 'Importing constraint statements for % 6s... ', $propertyIdSerialization ), $propertyIdSerialization ); |
|
| 60 | - $startTime = microtime( true ); |
|
| 61 | - $job = call_user_func( $this->newUpdateConstraintsTableJob, $propertyIdSerialization ); |
|
| 58 | + foreach ($this->propertyInfoLookup->getAllPropertyInfo() as $propertyIdSerialization => $info) { |
|
| 59 | + $this->output(sprintf('Importing constraint statements for % 6s... ', $propertyIdSerialization), $propertyIdSerialization); |
|
| 60 | + $startTime = microtime(true); |
|
| 61 | + $job = call_user_func($this->newUpdateConstraintsTableJob, $propertyIdSerialization); |
|
| 62 | 62 | $job->run(); |
| 63 | - $endTime = microtime( true ); |
|
| 64 | - $millis = ( $endTime - $startTime ) * 1000; |
|
| 65 | - $this->output( sprintf( 'done in % 6.2f ms.', $millis ), $propertyIdSerialization ); |
|
| 63 | + $endTime = microtime(true); |
|
| 64 | + $millis = ($endTime - $startTime) * 1000; |
|
| 65 | + $this->output(sprintf('done in % 6.2f ms.', $millis), $propertyIdSerialization); |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | |
@@ -83,34 +83,34 @@ discard block |
||
| 83 | 83 | * @throws SparqlHelperException if the checker uses SPARQL and the query times out or some other error occurs |
| 84 | 84 | * @return CheckResult |
| 85 | 85 | */ |
| 86 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
| 87 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
| 88 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
| 86 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
| 87 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
| 88 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
| 89 | 89 | } |
| 90 | - if ( $context->getType() === Context::TYPE_REFERENCE ) { |
|
| 91 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE ); |
|
| 90 | + if ($context->getType() === Context::TYPE_REFERENCE) { |
|
| 91 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $parameters = []; |
| 95 | 95 | $constraintParameters = $constraint->getConstraintParameters(); |
| 96 | 96 | |
| 97 | - $classes = $this->constraintParameterParser->parseClassParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
| 97 | + $classes = $this->constraintParameterParser->parseClassParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
| 98 | 98 | $parameters['class'] = array_map( |
| 99 | - function( $id ) { |
|
| 100 | - return new ItemId( $id ); |
|
| 99 | + function($id) { |
|
| 100 | + return new ItemId($id); |
|
| 101 | 101 | }, |
| 102 | 102 | $classes |
| 103 | 103 | ); |
| 104 | 104 | |
| 105 | - $relation = $this->constraintParameterParser->parseRelationParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
| 105 | + $relation = $this->constraintParameterParser->parseRelationParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
| 106 | 106 | $relationIds = []; |
| 107 | - if ( $relation === 'instance' || $relation === 'instanceOrSubclass' ) { |
|
| 108 | - $relationIds[] = $this->config->get( 'WBQualityConstraintsInstanceOfId' ); |
|
| 107 | + if ($relation === 'instance' || $relation === 'instanceOrSubclass') { |
|
| 108 | + $relationIds[] = $this->config->get('WBQualityConstraintsInstanceOfId'); |
|
| 109 | 109 | } |
| 110 | - if ( $relation === 'subclass' || $relation === 'instanceOrSubclass' ) { |
|
| 111 | - $relationIds[] = $this->config->get( 'WBQualityConstraintsSubclassOfId' ); |
|
| 110 | + if ($relation === 'subclass' || $relation === 'instanceOrSubclass') { |
|
| 111 | + $relationIds[] = $this->config->get('WBQualityConstraintsSubclassOfId'); |
|
| 112 | 112 | } |
| 113 | - $parameters['relation'] = [ $relation ]; |
|
| 113 | + $parameters['relation'] = [$relation]; |
|
| 114 | 114 | |
| 115 | 115 | $result = $this->typeCheckerHelper->hasClassInRelation( |
| 116 | 116 | $context->getEntity()->getStatements(), |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | $classes |
| 119 | 119 | ); |
| 120 | 120 | |
| 121 | - if ( $result->getBool() ) { |
|
| 121 | + if ($result->getBool()) { |
|
| 122 | 122 | $message = null; |
| 123 | 123 | $status = CheckResult::STATUS_COMPLIANCE; |
| 124 | 124 | } else { |
@@ -132,21 +132,21 @@ discard block |
||
| 132 | 132 | $status = CheckResult::STATUS_VIOLATION; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - return ( new CheckResult( $context, $constraint, $parameters, $status, $message ) ) |
|
| 136 | - ->withMetadata( $result->getMetadata() ); |
|
| 135 | + return (new CheckResult($context, $constraint, $parameters, $status, $message)) |
|
| 136 | + ->withMetadata($result->getMetadata()); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
| 139 | + public function checkConstraintParameters(Constraint $constraint) { |
|
| 140 | 140 | $constraintParameters = $constraint->getConstraintParameters(); |
| 141 | 141 | $exceptions = []; |
| 142 | 142 | try { |
| 143 | - $this->constraintParameterParser->parseClassParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
| 144 | - } catch ( ConstraintParameterException $e ) { |
|
| 143 | + $this->constraintParameterParser->parseClassParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
| 144 | + } catch (ConstraintParameterException $e) { |
|
| 145 | 145 | $exceptions[] = $e; |
| 146 | 146 | } |
| 147 | 147 | try { |
| 148 | - $this->constraintParameterParser->parseRelationParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
| 149 | - } catch ( ConstraintParameterException $e ) { |
|
| 148 | + $this->constraintParameterParser->parseRelationParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
| 149 | + } catch (ConstraintParameterException $e) { |
|
| 150 | 150 | $exceptions[] = $e; |
| 151 | 151 | } |
| 152 | 152 | return $exceptions; |
@@ -47,16 +47,16 @@ |
||
| 47 | 47 | * |
| 48 | 48 | * @return CheckResult |
| 49 | 49 | */ |
| 50 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
| 51 | - if ( $context->getType() === Context::TYPE_QUALIFIER ) { |
|
| 52 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE ); |
|
| 50 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
| 51 | + if ($context->getType() === Context::TYPE_QUALIFIER) { |
|
| 52 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE); |
|
| 53 | 53 | } else { |
| 54 | - $message = new ViolationMessage( 'wbqc-violation-message-qualifier' ); |
|
| 55 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message ); |
|
| 54 | + $message = new ViolationMessage('wbqc-violation-message-qualifier'); |
|
| 55 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
| 59 | + public function checkConstraintParameters(Constraint $constraint) { |
|
| 60 | 60 | // no parameters |
| 61 | 61 | return []; |
| 62 | 62 | } |
@@ -36,16 +36,16 @@ |
||
| 36 | 36 | ]; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
| 40 | - if ( $context->getType() === Context::TYPE_STATEMENT ) { |
|
| 41 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE ); |
|
| 39 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
| 40 | + if ($context->getType() === Context::TYPE_STATEMENT) { |
|
| 41 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE); |
|
| 42 | 42 | } else { |
| 43 | - $message = new ViolationMessage( 'wbqc-violation-message-valueOnly' ); |
|
| 44 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message ); |
|
| 43 | + $message = new ViolationMessage('wbqc-violation-message-valueOnly'); |
|
| 44 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message); |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
| 48 | + public function checkConstraintParameters(Constraint $constraint) { |
|
| 49 | 49 | // no parameters |
| 50 | 50 | return []; |
| 51 | 51 | } |