@@ -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 | } |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return CheckResult |
57 | 57 | */ |
58 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
59 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
60 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
58 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
59 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
60 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | $propertyId = $context->getSnak()->getPropertyId(); |
@@ -69,18 +69,18 @@ discard block |
||
69 | 69 | $propertyId |
70 | 70 | ); |
71 | 71 | |
72 | - if ( $propertyCount <= 1 ) { |
|
73 | - $message = new ViolationMessage( 'wbqc-violation-message-multi-value' ); |
|
72 | + if ($propertyCount <= 1) { |
|
73 | + $message = new ViolationMessage('wbqc-violation-message-multi-value'); |
|
74 | 74 | $status = CheckResult::STATUS_VIOLATION; |
75 | 75 | } else { |
76 | 76 | $message = null; |
77 | 77 | $status = CheckResult::STATUS_COMPLIANCE; |
78 | 78 | } |
79 | 79 | |
80 | - return new CheckResult( $context, $constraint, $parameters, $status, $message ); |
|
80 | + return new CheckResult($context, $constraint, $parameters, $status, $message); |
|
81 | 81 | } |
82 | 82 | |
83 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
83 | + public function checkConstraintParameters(Constraint $constraint) { |
|
84 | 84 | // no parameters |
85 | 85 | return []; |
86 | 86 | } |
@@ -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 | } |
@@ -36,16 +36,16 @@ |
||
36 | 36 | ]; |
37 | 37 | } |
38 | 38 | |
39 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
40 | - if ( $context->getType() === Context::TYPE_REFERENCE ) { |
|
41 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE ); |
|
39 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
40 | + if ($context->getType() === Context::TYPE_REFERENCE) { |
|
41 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE); |
|
42 | 42 | } else { |
43 | - $message = new ViolationMessage( 'wbqc-violation-message-reference' ); |
|
44 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message ); |
|
43 | + $message = new ViolationMessage('wbqc-violation-message-reference'); |
|
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 | } |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return CheckResult |
57 | 57 | */ |
58 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
59 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
60 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
58 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
59 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
60 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | $propertyId = $context->getSnak()->getPropertyId(); |
@@ -69,18 +69,18 @@ discard block |
||
69 | 69 | $propertyId |
70 | 70 | ); |
71 | 71 | |
72 | - if ( $propertyCount > 1 ) { |
|
73 | - $message = new ViolationMessage( 'wbqc-violation-message-single-value' ); |
|
72 | + if ($propertyCount > 1) { |
|
73 | + $message = new ViolationMessage('wbqc-violation-message-single-value'); |
|
74 | 74 | $status = CheckResult::STATUS_VIOLATION; |
75 | 75 | } else { |
76 | 76 | $message = null; |
77 | 77 | $status = CheckResult::STATUS_COMPLIANCE; |
78 | 78 | } |
79 | 79 | |
80 | - return new CheckResult( $context, $constraint, $parameters, $status, $message ); |
|
80 | + return new CheckResult($context, $constraint, $parameters, $status, $message); |
|
81 | 81 | } |
82 | 82 | |
83 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
83 | + public function checkConstraintParameters(Constraint $constraint) { |
|
84 | 84 | // no parameters |
85 | 85 | return []; |
86 | 86 | } |
@@ -71,40 +71,40 @@ |
||
71 | 71 | * @throws ConstraintParameterException |
72 | 72 | * @return CheckResult |
73 | 73 | */ |
74 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
75 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
76 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
74 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
75 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
76 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $parameters = []; |
80 | 80 | $constraintParameters = $constraint->getConstraintParameters(); |
81 | 81 | |
82 | - $propertyId = $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
83 | - $parameters['property'] = [ $propertyId ]; |
|
82 | + $propertyId = $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
83 | + $parameters['property'] = [$propertyId]; |
|
84 | 84 | |
85 | - $message = ( new ViolationMessage( 'wbqc-violation-message-mandatory-qualifier' ) ) |
|
86 | - ->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ) |
|
87 | - ->withEntityId( $propertyId, Role::QUALIFIER_PREDICATE ); |
|
85 | + $message = (new ViolationMessage('wbqc-violation-message-mandatory-qualifier')) |
|
86 | + ->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY) |
|
87 | + ->withEntityId($propertyId, Role::QUALIFIER_PREDICATE); |
|
88 | 88 | $status = CheckResult::STATUS_VIOLATION; |
89 | 89 | |
90 | 90 | /** @var Snak $qualifier */ |
91 | - foreach ( $context->getSnakStatement()->getQualifiers() as $qualifier ) { |
|
92 | - if ( $propertyId->equals( $qualifier->getPropertyId() ) ) { |
|
91 | + foreach ($context->getSnakStatement()->getQualifiers() as $qualifier) { |
|
92 | + if ($propertyId->equals($qualifier->getPropertyId())) { |
|
93 | 93 | $message = null; |
94 | 94 | $status = CheckResult::STATUS_COMPLIANCE; |
95 | 95 | break; |
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
99 | - return new CheckResult( $context, $constraint, $parameters, $status, $message ); |
|
99 | + return new CheckResult($context, $constraint, $parameters, $status, $message); |
|
100 | 100 | } |
101 | 101 | |
102 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
102 | + public function checkConstraintParameters(Constraint $constraint) { |
|
103 | 103 | $constraintParameters = $constraint->getConstraintParameters(); |
104 | 104 | $exceptions = []; |
105 | 105 | try { |
106 | - $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
107 | - } catch ( ConstraintParameterException $e ) { |
|
106 | + $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
107 | + } catch (ConstraintParameterException $e) { |
|
108 | 108 | $exceptions[] = $e; |
109 | 109 | } |
110 | 110 | return $exceptions; |
@@ -71,53 +71,53 @@ |
||
71 | 71 | * @throws ConstraintParameterException |
72 | 72 | * @return CheckResult |
73 | 73 | */ |
74 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
75 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
76 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
74 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
75 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
76 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $parameters = []; |
80 | 80 | $constraintParameters = $constraint->getConstraintParameters(); |
81 | 81 | |
82 | - $properties = $this->constraintParameterParser->parsePropertiesParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
82 | + $properties = $this->constraintParameterParser->parsePropertiesParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
83 | 83 | $parameters['property'] = $properties; |
84 | 84 | |
85 | 85 | $message = null; |
86 | 86 | $status = CheckResult::STATUS_COMPLIANCE; |
87 | 87 | |
88 | 88 | /** @var Snak $qualifier */ |
89 | - foreach ( $context->getSnakStatement()->getQualifiers() as $qualifier ) { |
|
89 | + foreach ($context->getSnakStatement()->getQualifiers() as $qualifier) { |
|
90 | 90 | $allowedQualifier = false; |
91 | - foreach ( $properties as $property ) { |
|
92 | - if ( $qualifier->getPropertyId()->equals( $property ) ) { |
|
91 | + foreach ($properties as $property) { |
|
92 | + if ($qualifier->getPropertyId()->equals($property)) { |
|
93 | 93 | $allowedQualifier = true; |
94 | 94 | break; |
95 | 95 | } |
96 | 96 | } |
97 | - if ( !$allowedQualifier ) { |
|
98 | - if ( empty( $properties ) || $properties === [ '' ] ) { |
|
99 | - $message = ( new ViolationMessage( 'wbqc-violation-message-no-qualifiers' ) ) |
|
100 | - ->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ); |
|
97 | + if (!$allowedQualifier) { |
|
98 | + if (empty($properties) || $properties === ['']) { |
|
99 | + $message = (new ViolationMessage('wbqc-violation-message-no-qualifiers')) |
|
100 | + ->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY); |
|
101 | 101 | } else { |
102 | - $message = ( new ViolationMessage( 'wbqc-violation-message-qualifiers' ) ) |
|
103 | - ->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ) |
|
104 | - ->withEntityId( $qualifier->getPropertyId(), Role::QUALIFIER_PREDICATE ) |
|
105 | - ->withEntityIdList( $properties, Role::QUALIFIER_PREDICATE ); |
|
102 | + $message = (new ViolationMessage('wbqc-violation-message-qualifiers')) |
|
103 | + ->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY) |
|
104 | + ->withEntityId($qualifier->getPropertyId(), Role::QUALIFIER_PREDICATE) |
|
105 | + ->withEntityIdList($properties, Role::QUALIFIER_PREDICATE); |
|
106 | 106 | } |
107 | 107 | $status = CheckResult::STATUS_VIOLATION; |
108 | 108 | break; |
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | - return new CheckResult( $context, $constraint, $parameters, $status, $message ); |
|
112 | + return new CheckResult($context, $constraint, $parameters, $status, $message); |
|
113 | 113 | } |
114 | 114 | |
115 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
115 | + public function checkConstraintParameters(Constraint $constraint) { |
|
116 | 116 | $constraintParameters = $constraint->getConstraintParameters(); |
117 | 117 | $exceptions = []; |
118 | 118 | try { |
119 | - $this->constraintParameterParser->parsePropertiesParameter( $constraintParameters, $constraint->getConstraintTypeItemId() ); |
|
120 | - } catch ( ConstraintParameterException $e ) { |
|
119 | + $this->constraintParameterParser->parsePropertiesParameter($constraintParameters, $constraint->getConstraintTypeItemId()); |
|
120 | + } catch (ConstraintParameterException $e) { |
|
121 | 121 | $exceptions[] = $e; |
122 | 122 | } |
123 | 123 | return $exceptions; |
@@ -74,22 +74,22 @@ discard block |
||
74 | 74 | * @throws SparqlHelperException if the checker uses SPARQL and the query times out or some other error occurs |
75 | 75 | * @return CheckResult |
76 | 76 | */ |
77 | - public function checkConstraint( Context $context, Constraint $constraint ) { |
|
78 | - if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) { |
|
79 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED ); |
|
77 | + public function checkConstraint(Context $context, Constraint $constraint) { |
|
78 | + if ($context->getSnakRank() === Statement::RANK_DEPRECATED) { |
|
79 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $parameters = []; |
83 | 83 | |
84 | - if ( $this->sparqlHelper !== null ) { |
|
85 | - if ( $context->getType() === 'statement' ) { |
|
84 | + if ($this->sparqlHelper !== null) { |
|
85 | + if ($context->getType() === 'statement') { |
|
86 | 86 | $result = $this->sparqlHelper->findEntitiesWithSameStatement( |
87 | 87 | $context->getSnakStatement(), |
88 | 88 | true // ignore deprecated statements |
89 | 89 | ); |
90 | 90 | } else { |
91 | - if ( $context->getSnak()->getType() !== 'value' ) { |
|
92 | - return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE ); |
|
91 | + if ($context->getSnak()->getType() !== 'value') { |
|
92 | + return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE); |
|
93 | 93 | } |
94 | 94 | $result = $this->sparqlHelper->findEntitiesWithSameQualifierOrReference( |
95 | 95 | $context->getEntity()->getId(), |
@@ -102,27 +102,27 @@ discard block |
||
102 | 102 | $otherEntities = $result->getArray(); |
103 | 103 | $metadata = $result->getMetadata(); |
104 | 104 | |
105 | - if ( $otherEntities === [] ) { |
|
105 | + if ($otherEntities === []) { |
|
106 | 106 | $status = CheckResult::STATUS_COMPLIANCE; |
107 | 107 | $message = null; |
108 | 108 | } else { |
109 | - $otherEntities = array_values( array_filter( $otherEntities ) ); // remove nulls |
|
109 | + $otherEntities = array_values(array_filter($otherEntities)); // remove nulls |
|
110 | 110 | $status = CheckResult::STATUS_VIOLATION; |
111 | - $message = ( new ViolationMessage( 'wbqc-violation-message-unique-value' ) ) |
|
112 | - ->withEntityIdList( $otherEntities, Role::SUBJECT ); |
|
111 | + $message = (new ViolationMessage('wbqc-violation-message-unique-value')) |
|
112 | + ->withEntityIdList($otherEntities, Role::SUBJECT); |
|
113 | 113 | } |
114 | 114 | } else { |
115 | 115 | $status = CheckResult::STATUS_TODO; |
116 | - $message = ( new ViolationMessage( 'wbqc-violation-message-not-yet-implemented' ) ) |
|
117 | - ->withEntityId( new ItemId( $constraint->getConstraintTypeItemId() ), Role::CONSTRAINT_TYPE_ITEM ); |
|
116 | + $message = (new ViolationMessage('wbqc-violation-message-not-yet-implemented')) |
|
117 | + ->withEntityId(new ItemId($constraint->getConstraintTypeItemId()), Role::CONSTRAINT_TYPE_ITEM); |
|
118 | 118 | $metadata = Metadata::blank(); |
119 | 119 | } |
120 | 120 | |
121 | - return ( new CheckResult( $context, $constraint, $parameters, $status, $message ) ) |
|
122 | - ->withMetadata( $metadata ); |
|
121 | + return (new CheckResult($context, $constraint, $parameters, $status, $message)) |
|
122 | + ->withMetadata($metadata); |
|
123 | 123 | } |
124 | 124 | |
125 | - public function checkConstraintParameters( Constraint $constraint ) { |
|
125 | + public function checkConstraintParameters(Constraint $constraint) { |
|
126 | 126 | // no parameters |
127 | 127 | return []; |
128 | 128 | } |