Completed
Push — master ( 12a9a3...d22875 )
by
unknown
02:45
created
src/ConstraintCheck/Checker/TypeChecker.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -89,32 +89,32 @@  discard block
 block discarded – undo
89 89
 	 * @throws SparqlHelperException if the checker uses SPARQL and the query times out or some other error occurs
90 90
 	 * @return CheckResult
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
-		if ( $context->getType() === Context::TYPE_REFERENCE ) {
97
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE );
96
+		if ($context->getType() === Context::TYPE_REFERENCE) {
97
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_NOT_IN_SCOPE);
98 98
 		}
99 99
 
100 100
 		$parameters = [];
101 101
 		$constraintParameters = $constraint->getConstraintParameters();
102 102
 
103
-		$classes = $this->constraintParameterParser->parseClassParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
103
+		$classes = $this->constraintParameterParser->parseClassParameter($constraintParameters, $constraint->getConstraintTypeItemId());
104 104
 		$parameters['class'] = array_map(
105
-			function( $id ) {
106
-				return new ItemId( $id );
105
+			function($id) {
106
+				return new ItemId($id);
107 107
 			},
108 108
 			$classes
109 109
 		);
110 110
 
111
-		$relation = $this->constraintParameterParser->parseRelationParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
112
-		if ( $relation === 'instance' ) {
113
-			$relationId = $this->config->get( 'WBQualityConstraintsInstanceOfId' );
114
-		} elseif ( $relation === 'subclass' ) {
115
-			$relationId = $this->config->get( 'WBQualityConstraintsSubclassOfId' );
111
+		$relation = $this->constraintParameterParser->parseRelationParameter($constraintParameters, $constraint->getConstraintTypeItemId());
112
+		if ($relation === 'instance') {
113
+			$relationId = $this->config->get('WBQualityConstraintsInstanceOfId');
114
+		} elseif ($relation === 'subclass') {
115
+			$relationId = $this->config->get('WBQualityConstraintsSubclassOfId');
116 116
 		}
117
-		$parameters['relation'] = [ $relation ];
117
+		$parameters['relation'] = [$relation];
118 118
 
119 119
 		$result = $this->typeCheckerHelper->hasClassInRelation(
120 120
 			$context->getEntity()->getStatements(),
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 			$classes
123 123
 		);
124 124
 
125
-		if ( $result->getBool() ) {
125
+		if ($result->getBool()) {
126 126
 			$message = '';
127 127
 			$status = CheckResult::STATUS_COMPLIANCE;
128 128
 		} else {
@@ -136,21 +136,21 @@  discard block
 block discarded – undo
136 136
 			$status = CheckResult::STATUS_VIOLATION;
137 137
 		}
138 138
 
139
-		return ( new CheckResult( $context, $constraint, $parameters, $status, $message ) )
140
-			->withMetadata( $result->getMetadata() );
139
+		return (new CheckResult($context, $constraint, $parameters, $status, $message))
140
+			->withMetadata($result->getMetadata());
141 141
 	}
142 142
 
143
-	public function checkConstraintParameters( Constraint $constraint ) {
143
+	public function checkConstraintParameters(Constraint $constraint) {
144 144
 		$constraintParameters = $constraint->getConstraintParameters();
145 145
 		$exceptions = [];
146 146
 		try {
147
-			$this->constraintParameterParser->parseClassParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
148
-		} catch ( ConstraintParameterException $e ) {
147
+			$this->constraintParameterParser->parseClassParameter($constraintParameters, $constraint->getConstraintTypeItemId());
148
+		} catch (ConstraintParameterException $e) {
149 149
 			$exceptions[] = $e;
150 150
 		}
151 151
 		try {
152
-			$this->constraintParameterParser->parseRelationParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
153
-		} catch ( ConstraintParameterException $e ) {
152
+			$this->constraintParameterParser->parseRelationParameter($constraintParameters, $constraint->getConstraintTypeItemId());
153
+		} catch (ConstraintParameterException $e) {
154 154
 			$exceptions[] = $e;
155 155
 		}
156 156
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ValueOnlyChecker.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@
 block discarded – undo
35 35
 		];
36 36
 	}
37 37
 
38
-	public function checkConstraint( Context $context, Constraint $constraint ) {
39
-		if ( $context->getType() === Context::TYPE_STATEMENT ) {
40
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE, '' );
38
+	public function checkConstraint(Context $context, Constraint $constraint) {
39
+		if ($context->getType() === Context::TYPE_STATEMENT) {
40
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE, '');
41 41
 		} else {
42
-			$message = wfMessage( 'wbqc-violation-message-valueOnly' )->escaped();
43
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
42
+			$message = wfMessage('wbqc-violation-message-valueOnly')->escaped();
43
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
44 44
 		}
45 45
 	}
46 46
 
47
-	public function checkConstraintParameters( Constraint $constraint ) {
47
+	public function checkConstraintParameters(Constraint $constraint) {
48 48
 		// no parameters
49 49
 		return [];
50 50
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ReferenceChecker.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@
 block discarded – undo
35 35
 		];
36 36
 	}
37 37
 
38
-	public function checkConstraint( Context $context, Constraint $constraint ) {
39
-		if ( $context->getType() === Context::TYPE_REFERENCE ) {
40
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE, '' );
38
+	public function checkConstraint(Context $context, Constraint $constraint) {
39
+		if ($context->getType() === Context::TYPE_REFERENCE) {
40
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE, '');
41 41
 		} else {
42
-			$message = wfMessage( 'wbqc-violation-message-reference' )->escaped();
43
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
42
+			$message = wfMessage('wbqc-violation-message-reference')->escaped();
43
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
44 44
 		}
45 45
 	}
46 46
 
47
-	public function checkConstraintParameters( Constraint $constraint ) {
47
+	public function checkConstraintParameters(Constraint $constraint) {
48 48
 		// no parameters
49 49
 		return [];
50 50
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/SymmetricChecker.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return CheckResult
86 86
 	 */
87
-	public function checkConstraint( Context $context, Constraint $constraint ) {
88
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
89
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
87
+	public function checkConstraint(Context $context, Constraint $constraint) {
88
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
89
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
90 90
 		}
91 91
 
92 92
 		$parameters = [];
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 		$snak = $context->getSnak();
95 95
 		$propertyId = $context->getSnak()->getPropertyId();
96 96
 
97
-		if ( !$snak instanceof PropertyValueSnak ) {
97
+		if (!$snak instanceof PropertyValueSnak) {
98 98
 			// nothing to check
99
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE, '' );
99
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE, '');
100 100
 		}
101 101
 
102 102
 		$dataValue = $snak->getDataValue();
@@ -105,22 +105,22 @@  discard block
 block discarded – undo
105 105
 		 * error handling:
106 106
 		 *   type of $dataValue for properties with 'Symmetric' constraint has to be 'wikibase-entityid'
107 107
 		 */
108
-		if ( $dataValue->getType() !== 'wikibase-entityid' ) {
109
-			$message = wfMessage( "wbqc-violation-message-value-needed-of-type" )
108
+		if ($dataValue->getType() !== 'wikibase-entityid') {
109
+			$message = wfMessage("wbqc-violation-message-value-needed-of-type")
110 110
 					 ->rawParams(
111
-						 $this->constraintParameterRenderer->formatItemId( $constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM ),
111
+						 $this->constraintParameterRenderer->formatItemId($constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM),
112 112
 						 'wikibase-entityid' // TODO is there a message for this type so we can localize it?
113 113
 					 )
114 114
 					 ->escaped();
115
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
115
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message);
116 116
 		}
117 117
 		/** @var EntityIdValue $dataValue */
118 118
 
119 119
 		$targetEntityId = $dataValue->getEntityId();
120
-		$targetEntity = $this->entityLookup->getEntity( $targetEntityId );
121
-		if ( $targetEntity === null ) {
122
-			$message = wfMessage( "wbqc-violation-message-target-entity-must-exist" )->escaped();
123
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
120
+		$targetEntity = $this->entityLookup->getEntity($targetEntityId);
121
+		if ($targetEntity === null) {
122
+			$message = wfMessage("wbqc-violation-message-target-entity-must-exist")->escaped();
123
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message);
124 124
 		}
125 125
 
126 126
 		$symmetricStatement = $this->connectionCheckerHelper->findStatementWithPropertyAndEntityIdValue(
@@ -128,26 +128,26 @@  discard block
 block discarded – undo
128 128
 			$propertyId,
129 129
 			$context->getEntity()->getId()
130 130
 		);
131
-		if ( $symmetricStatement !== null ) {
131
+		if ($symmetricStatement !== null) {
132 132
 			$message = '';
133 133
 			$status = CheckResult::STATUS_COMPLIANCE;
134 134
 		} else {
135
-			$message = wfMessage( 'wbqc-violation-message-symmetric' )
135
+			$message = wfMessage('wbqc-violation-message-symmetric')
136 136
 					 ->rawParams(
137
-						 $this->constraintParameterRenderer->formatEntityId( $targetEntityId, Role::SUBJECT ),
138
-						 $this->constraintParameterRenderer->formatEntityId( $propertyId, Role::PREDICATE ),
139
-						 $this->constraintParameterRenderer->formatEntityId( $context->getEntity()->getId(), Role::OBJECT )
137
+						 $this->constraintParameterRenderer->formatEntityId($targetEntityId, Role::SUBJECT),
138
+						 $this->constraintParameterRenderer->formatEntityId($propertyId, Role::PREDICATE),
139
+						 $this->constraintParameterRenderer->formatEntityId($context->getEntity()->getId(), Role::OBJECT)
140 140
 					 )
141 141
 					 ->escaped();
142 142
 			$status = CheckResult::STATUS_VIOLATION;
143 143
 		}
144 144
 
145
-		return ( new CheckResult( $context, $constraint, $parameters, $status, $message ) )
146
-			->withMetadata( Metadata::ofDependencyMetadata(
147
-				DependencyMetadata::ofEntityId( $targetEntityId ) ) );
145
+		return (new CheckResult($context, $constraint, $parameters, $status, $message))
146
+			->withMetadata(Metadata::ofDependencyMetadata(
147
+				DependencyMetadata::ofEntityId($targetEntityId) ));
148 148
 	}
149 149
 
150
-	public function checkConstraintParameters( Constraint $constraint ) {
150
+	public function checkConstraintParameters(Constraint $constraint) {
151 151
 		// no parameters
152 152
 		return [];
153 153
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/QualifiersChecker.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -70,43 +70,43 @@  discard block
 block discarded – undo
70 70
 	 * @throws ConstraintParameterException
71 71
 	 * @return CheckResult
72 72
 	 */
73
-	public function checkConstraint( Context $context, Constraint $constraint ) {
74
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
75
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
73
+	public function checkConstraint(Context $context, Constraint $constraint) {
74
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
75
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
76 76
 		}
77 77
 
78 78
 		$parameters = [];
79 79
 		$constraintParameters = $constraint->getConstraintParameters();
80 80
 
81
-		$properties = $this->constraintParameterParser->parsePropertiesParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
81
+		$properties = $this->constraintParameterParser->parsePropertiesParameter($constraintParameters, $constraint->getConstraintTypeItemId());
82 82
 		$parameters['property'] = $properties;
83 83
 
84 84
 		$message = '';
85 85
 		$status = CheckResult::STATUS_COMPLIANCE;
86 86
 
87 87
 		/** @var Snak $qualifier */
88
-		foreach ( $context->getSnakStatement()->getQualifiers() as $qualifier ) {
88
+		foreach ($context->getSnakStatement()->getQualifiers() as $qualifier) {
89 89
 			$allowedQualifier = false;
90
-			foreach ( $properties as $property ) {
91
-				if ( $qualifier->getPropertyId()->equals( $property ) ) {
90
+			foreach ($properties as $property) {
91
+				if ($qualifier->getPropertyId()->equals($property)) {
92 92
 					$allowedQualifier = true;
93 93
 					break;
94 94
 				}
95 95
 			}
96
-			if ( !$allowedQualifier ) {
97
-				if ( empty( $properties ) || $properties === [ '' ] ) {
98
-					$message = wfMessage( 'wbqc-violation-message-no-qualifiers' );
96
+			if (!$allowedQualifier) {
97
+				if (empty($properties) || $properties === ['']) {
98
+					$message = wfMessage('wbqc-violation-message-no-qualifiers');
99 99
 					$message->rawParams(
100
-						$this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY )
100
+						$this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY)
101 101
 					);
102 102
 				} else {
103
-					$message = wfMessage( "wbqc-violation-message-qualifiers" );
103
+					$message = wfMessage("wbqc-violation-message-qualifiers");
104 104
 					$message->rawParams(
105
-						$this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ),
106
-						$this->constraintParameterRenderer->formatEntityId( $qualifier->getPropertyId(), Role::QUALIFIER_PREDICATE )
105
+						$this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY),
106
+						$this->constraintParameterRenderer->formatEntityId($qualifier->getPropertyId(), Role::QUALIFIER_PREDICATE)
107 107
 					);
108
-					$message->numParams( count( $properties ) );
109
-					$message->rawParams( $this->constraintParameterRenderer->formatPropertyIdList( $properties, Role::QUALIFIER_PREDICATE ) );
108
+					$message->numParams(count($properties));
109
+					$message->rawParams($this->constraintParameterRenderer->formatPropertyIdList($properties, Role::QUALIFIER_PREDICATE));
110 110
 				}
111 111
 				$message = $message->escaped();
112 112
 				$status = CheckResult::STATUS_VIOLATION;
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 			}
115 115
 		}
116 116
 
117
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
117
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
118 118
 	}
119 119
 
120
-	public function checkConstraintParameters( Constraint $constraint ) {
120
+	public function checkConstraintParameters(Constraint $constraint) {
121 121
 		$constraintParameters = $constraint->getConstraintParameters();
122 122
 		$exceptions = [];
123 123
 		try {
124
-			$this->constraintParameterParser->parsePropertiesParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
125
-		} catch ( ConstraintParameterException $e ) {
124
+			$this->constraintParameterParser->parsePropertiesParameter($constraintParameters, $constraint->getConstraintTypeItemId());
125
+		} catch (ConstraintParameterException $e) {
126 126
 			$exceptions[] = $e;
127 127
 		}
128 128
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/MultiValueChecker.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,29 +35,29 @@
 block discarded – undo
35 35
 	 *
36 36
 	 * @return CheckResult
37 37
 	 */
38
-	public function checkConstraint( Context $context, Constraint $constraint ) {
39
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
40
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
38
+	public function checkConstraint(Context $context, Constraint $constraint) {
39
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
40
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
41 41
 		}
42 42
 
43 43
 		$propertyId = $context->getSnak()->getPropertyId();
44 44
 
45 45
 		$parameters = [];
46 46
 
47
-		$propertyCountArray = $this->valueCountCheckerHelper->getPropertyCount( $context->getEntity()->getStatements() );
47
+		$propertyCountArray = $this->valueCountCheckerHelper->getPropertyCount($context->getEntity()->getStatements());
48 48
 
49
-		if ( $propertyCountArray[$propertyId->getSerialization()] <= 1 ) {
50
-			$message = wfMessage( "wbqc-violation-message-multi-value" )->escaped();
49
+		if ($propertyCountArray[$propertyId->getSerialization()] <= 1) {
50
+			$message = wfMessage("wbqc-violation-message-multi-value")->escaped();
51 51
 			$status = CheckResult::STATUS_VIOLATION;
52 52
 		} else {
53 53
 			$message = '';
54 54
 			$status = CheckResult::STATUS_COMPLIANCE;
55 55
 		}
56 56
 
57
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
57
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
58 58
 	}
59 59
 
60
-	public function checkConstraintParameters( Constraint $constraint ) {
60
+	public function checkConstraintParameters(Constraint $constraint) {
61 61
 		// no parameters
62 62
 		return [];
63 63
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/SingleValueChecker.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -35,29 +35,29 @@
 block discarded – undo
35 35
 	 *
36 36
 	 * @return CheckResult
37 37
 	 */
38
-	public function checkConstraint( Context $context, Constraint $constraint ) {
39
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
40
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
38
+	public function checkConstraint(Context $context, Constraint $constraint) {
39
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
40
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
41 41
 		}
42 42
 
43 43
 		$propertyId = $context->getSnak()->getPropertyId();
44 44
 
45 45
 		$parameters = [];
46 46
 
47
-		$propertyCountArray = $this->valueCountCheckerHelper->getPropertyCount( $context->getEntity()->getStatements() );
47
+		$propertyCountArray = $this->valueCountCheckerHelper->getPropertyCount($context->getEntity()->getStatements());
48 48
 
49
-		if ( $propertyCountArray[$propertyId->getSerialization()] > 1 ) {
50
-			$message = wfMessage( "wbqc-violation-message-single-value" )->escaped();
49
+		if ($propertyCountArray[$propertyId->getSerialization()] > 1) {
50
+			$message = wfMessage("wbqc-violation-message-single-value")->escaped();
51 51
 			$status = CheckResult::STATUS_VIOLATION;
52 52
 		} else {
53 53
 			$message = '';
54 54
 			$status = CheckResult::STATUS_COMPLIANCE;
55 55
 		}
56 56
 
57
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
57
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
58 58
 	}
59 59
 
60
-	public function checkConstraintParameters( Constraint $constraint ) {
60
+	public function checkConstraintParameters(Constraint $constraint) {
61 61
 		// no parameters
62 62
 		return [];
63 63
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ConflictsWithChecker.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -92,18 +92,18 @@  discard block
 block discarded – undo
92 92
 	 * @throws ConstraintParameterException
93 93
 	 * @return CheckResult
94 94
 	 */
95
-	public function checkConstraint( Context $context, Constraint $constraint ) {
96
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
97
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
95
+	public function checkConstraint(Context $context, Constraint $constraint) {
96
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
97
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
98 98
 		}
99 99
 
100 100
 		$parameters = [];
101 101
 		$constraintParameters = $constraint->getConstraintParameters();
102 102
 
103
-		$propertyId = $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
104
-		$parameters['property'] = [ $propertyId ];
103
+		$propertyId = $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
104
+		$parameters['property'] = [$propertyId];
105 105
 
106
-		$items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
106
+		$items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
107 107
 		$parameters['items'] = $items;
108 108
 
109 109
 		/*
@@ -111,16 +111,16 @@  discard block
 block discarded – undo
111 111
 		 *   a) a property only
112 112
 		 *   b) a property and a number of items (each combination of property and item forming an individual claim)
113 113
 		 */
114
-		if ( $items === [] ) {
114
+		if ($items === []) {
115 115
 			$offendingStatement = $this->connectionCheckerHelper->findStatementWithProperty(
116 116
 				$context->getEntity()->getStatements(),
117 117
 				$propertyId
118 118
 			);
119
-			if ( $offendingStatement !== null ) {
120
-				$message = wfMessage( "wbqc-violation-message-conflicts-with-property" )
119
+			if ($offendingStatement !== null) {
120
+				$message = wfMessage("wbqc-violation-message-conflicts-with-property")
121 121
 						 ->rawParams(
122
-							 $this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ),
123
-							 $this->constraintParameterRenderer->formatEntityId( $propertyId, Role::PREDICATE )
122
+							 $this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY),
123
+							 $this->constraintParameterRenderer->formatEntityId($propertyId, Role::PREDICATE)
124 124
 						 )
125 125
 						 ->escaped();
126 126
 				$status = CheckResult::STATUS_VIOLATION;
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 				$propertyId,
135 135
 				$items
136 136
 			);
137
-			if ( $offendingStatement !== null ) {
138
-				$offendingValue = ItemIdSnakValue::fromSnak( $offendingStatement->getMainSnak() );
139
-				$message = wfMessage( "wbqc-violation-message-conflicts-with-claim" )
137
+			if ($offendingStatement !== null) {
138
+				$offendingValue = ItemIdSnakValue::fromSnak($offendingStatement->getMainSnak());
139
+				$message = wfMessage("wbqc-violation-message-conflicts-with-claim")
140 140
 						 ->rawParams(
141
-							 $this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ),
142
-							 $this->constraintParameterRenderer->formatEntityId( $propertyId, Role::PREDICATE ),
143
-							 $this->constraintParameterRenderer->formatItemIdSnakValue( $offendingValue, Role::OBJECT )
141
+							 $this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY),
142
+							 $this->constraintParameterRenderer->formatEntityId($propertyId, Role::PREDICATE),
143
+							 $this->constraintParameterRenderer->formatItemIdSnakValue($offendingValue, Role::OBJECT)
144 144
 						 )
145 145
 						 ->escaped();
146 146
 				$status = CheckResult::STATUS_VIOLATION;
@@ -150,20 +150,20 @@  discard block
 block discarded – undo
150 150
 			}
151 151
 		}
152 152
 
153
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
153
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
154 154
 	}
155 155
 
156
-	public function checkConstraintParameters( Constraint $constraint ) {
156
+	public function checkConstraintParameters(Constraint $constraint) {
157 157
 		$constraintParameters = $constraint->getConstraintParameters();
158 158
 		$exceptions = [];
159 159
 		try {
160
-			$this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
161
-		} catch ( ConstraintParameterException $e ) {
160
+			$this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
161
+		} catch (ConstraintParameterException $e) {
162 162
 			$exceptions[] = $e;
163 163
 		}
164 164
 		try {
165
-			$this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
166
-		} catch ( ConstraintParameterException $e ) {
165
+			$this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
166
+		} catch (ConstraintParameterException $e) {
167 167
 			$exceptions[] = $e;
168 168
 		}
169 169
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ItemChecker.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -91,18 +91,18 @@  discard block
 block discarded – undo
91 91
 	 * @throws ConstraintParameterException
92 92
 	 * @return CheckResult
93 93
 	 */
94
-	public function checkConstraint( Context $context, Constraint $constraint ) {
95
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
96
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
94
+	public function checkConstraint(Context $context, Constraint $constraint) {
95
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
96
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
97 97
 		}
98 98
 
99 99
 		$parameters = [];
100 100
 		$constraintParameters = $constraint->getConstraintParameters();
101 101
 
102
-		$propertyId = $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
103
-		$parameters['property'] = [ $propertyId ];
102
+		$propertyId = $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
103
+		$parameters['property'] = [$propertyId];
104 104
 
105
-		$items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
105
+		$items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
106 106
 		$parameters['items'] = $items;
107 107
 
108 108
 		/*
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 		 *   a) a property only
111 111
 		 *   b) a property and a number of items (each combination of property and item forming an individual claim)
112 112
 		 */
113
-		if ( $items === [] ) {
113
+		if ($items === []) {
114 114
 			$requiredStatement = $this->connectionCheckerHelper->findStatementWithProperty(
115 115
 				$context->getEntity()->getStatements(),
116 116
 				$propertyId
@@ -123,35 +123,35 @@  discard block
 block discarded – undo
123 123
 			);
124 124
 		}
125 125
 
126
-		if ( $requiredStatement !== null ) {
126
+		if ($requiredStatement !== null) {
127 127
 			$status = CheckResult::STATUS_COMPLIANCE;
128 128
 			$message = '';
129 129
 		} else {
130 130
 			$status = CheckResult::STATUS_VIOLATION;
131
-			$message = wfMessage( 'wbqc-violation-message-item' );
131
+			$message = wfMessage('wbqc-violation-message-item');
132 132
 			$message->rawParams(
133
-				$this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ),
134
-				$this->constraintParameterRenderer->formatEntityId( $propertyId, Role::PREDICATE )
133
+				$this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY),
134
+				$this->constraintParameterRenderer->formatEntityId($propertyId, Role::PREDICATE)
135 135
 			);
136
-			$message->numParams( count( $items ) );
137
-			$message->rawParams( $this->constraintParameterRenderer->formatItemIdSnakValueList( $items, Role::OBJECT ) );
136
+			$message->numParams(count($items));
137
+			$message->rawParams($this->constraintParameterRenderer->formatItemIdSnakValueList($items, Role::OBJECT));
138 138
 			$message = $message->escaped();
139 139
 		}
140 140
 
141
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
141
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
142 142
 	}
143 143
 
144
-	public function checkConstraintParameters( Constraint $constraint ) {
144
+	public function checkConstraintParameters(Constraint $constraint) {
145 145
 		$constraintParameters = $constraint->getConstraintParameters();
146 146
 		$exceptions = [];
147 147
 		try {
148
-			$this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
149
-		} catch ( ConstraintParameterException $e ) {
148
+			$this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
149
+		} catch (ConstraintParameterException $e) {
150 150
 			$exceptions[] = $e;
151 151
 		}
152 152
 		try {
153
-			$this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
154
-		} catch ( ConstraintParameterException $e ) {
153
+			$this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
154
+		} catch (ConstraintParameterException $e) {
155 155
 			$exceptions[] = $e;
156 156
 		}
157 157
 		return $exceptions;
Please login to merge, or discard this patch.