Completed
Push — master ( 87e669...59be4e )
by
unknown
02:24
created
src/ConstraintCheck/Checker/MultiValueChecker.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,33 +35,33 @@
 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
-		if ( $context->getType() !== Context::TYPE_STATEMENT ) {
42
+		if ($context->getType() !== Context::TYPE_STATEMENT) {
43 43
 			// TODO T175566
44
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_NOT_MAIN_SNAK );
44
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_NOT_MAIN_SNAK);
45 45
 		}
46 46
 
47 47
 		$propertyId = $context->getSnak()->getPropertyId();
48 48
 
49 49
 		$parameters = [];
50 50
 
51
-		$propertyCountArray = $this->valueCountCheckerHelper->getPropertyCount( $context->getEntity()->getStatements() );
51
+		$propertyCountArray = $this->valueCountCheckerHelper->getPropertyCount($context->getEntity()->getStatements());
52 52
 
53
-		if ( $propertyCountArray[$propertyId->getSerialization()] <= 1 ) {
54
-			$message = wfMessage( "wbqc-violation-message-multi-value" )->escaped();
53
+		if ($propertyCountArray[$propertyId->getSerialization()] <= 1) {
54
+			$message = wfMessage("wbqc-violation-message-multi-value")->escaped();
55 55
 			$status = CheckResult::STATUS_VIOLATION;
56 56
 		} else {
57 57
 			$message = '';
58 58
 			$status = CheckResult::STATUS_COMPLIANCE;
59 59
 		}
60 60
 
61
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
61
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
62 62
 	}
63 63
 
64
-	public function checkConstraintParameters( Constraint $constraint ) {
64
+	public function checkConstraintParameters(Constraint $constraint) {
65 65
 		// no parameters
66 66
 		return [];
67 67
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/ItemChecker.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -69,22 +69,22 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @return CheckResult
71 71
 	 */
72
-	public function checkConstraint( Context $context, Constraint $constraint ) {
73
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
74
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
72
+	public function checkConstraint(Context $context, Constraint $constraint) {
73
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
74
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
75 75
 		}
76
-		if ( $context->getType() !== Context::TYPE_STATEMENT ) {
76
+		if ($context->getType() !== Context::TYPE_STATEMENT) {
77 77
 			// TODO T175562
78
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_NOT_MAIN_SNAK );
78
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_NOT_MAIN_SNAK);
79 79
 		}
80 80
 
81 81
 		$parameters = [];
82 82
 		$constraintParameters = $constraint->getConstraintParameters();
83 83
 
84
-		$propertyId = $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
85
-		$parameters['property'] = [ $propertyId ];
84
+		$propertyId = $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
85
+		$parameters['property'] = [$propertyId];
86 86
 
87
-		$items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
87
+		$items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
88 88
 		$parameters['items'] = $items;
89 89
 
90 90
 		/*
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		 *   a) a property only
93 93
 		 *   b) a property and a number of items (each combination of property and item forming an individual claim)
94 94
 		 */
95
-		if ( $items === [] ) {
95
+		if ($items === []) {
96 96
 			$requiredStatement = $this->connectionCheckerHelper->findStatementWithProperty(
97 97
 				$context->getEntity()->getStatements(),
98 98
 				$propertyId
@@ -105,35 +105,35 @@  discard block
 block discarded – undo
105 105
 			);
106 106
 		}
107 107
 
108
-		if ( $requiredStatement !== null ) {
108
+		if ($requiredStatement !== null) {
109 109
 			$status = CheckResult::STATUS_COMPLIANCE;
110 110
 			$message = '';
111 111
 		} else {
112 112
 			$status = CheckResult::STATUS_VIOLATION;
113
-			$message = wfMessage( 'wbqc-violation-message-item' );
113
+			$message = wfMessage('wbqc-violation-message-item');
114 114
 			$message->rawParams(
115
-				$this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ),
116
-				$this->constraintParameterRenderer->formatEntityId( $propertyId, Role::PREDICATE )
115
+				$this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY),
116
+				$this->constraintParameterRenderer->formatEntityId($propertyId, Role::PREDICATE)
117 117
 			);
118
-			$message->numParams( count( $items ) );
119
-			$message->rawParams( $this->constraintParameterRenderer->formatItemIdSnakValueList( $items, Role::OBJECT ) );
118
+			$message->numParams(count($items));
119
+			$message->rawParams($this->constraintParameterRenderer->formatItemIdSnakValueList($items, Role::OBJECT));
120 120
 			$message = $message->escaped();
121 121
 		}
122 122
 
123
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
123
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
124 124
 	}
125 125
 
126
-	public function checkConstraintParameters( Constraint $constraint ) {
126
+	public function checkConstraintParameters(Constraint $constraint) {
127 127
 		$constraintParameters = $constraint->getConstraintParameters();
128 128
 		$exceptions = [];
129 129
 		try {
130
-			$this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
131
-		} catch ( ConstraintParameterException $e ) {
130
+			$this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
131
+		} catch (ConstraintParameterException $e) {
132 132
 			$exceptions[] = $e;
133 133
 		}
134 134
 		try {
135
-			$this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
136
-		} catch ( ConstraintParameterException $e ) {
135
+			$this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
136
+		} catch (ConstraintParameterException $e) {
137 137
 			$exceptions[] = $e;
138 138
 		}
139 139
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/FormatChecker.php 1 patch
Spacing   +30 added lines, -31 removed lines patch added patch discarded remove patch
@@ -73,26 +73,26 @@  discard block
 block discarded – undo
73 73
 	 *
74 74
 	 * @return CheckResult
75 75
 	 */
76
-	public function checkConstraint( Context $context, Constraint $constraint ) {
76
+	public function checkConstraint(Context $context, Constraint $constraint) {
77 77
 		$parameters = [];
78 78
 		$constraintParameters = $constraint->getConstraintParameters();
79 79
 
80
-		$format = $this->constraintParameterParser->parseFormatParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
81
-		$parameters['pattern'] = [ $format ];
80
+		$format = $this->constraintParameterParser->parseFormatParameter($constraintParameters, $constraint->getConstraintTypeItemId());
81
+		$parameters['pattern'] = [$format];
82 82
 
83 83
 		$syntaxClarification = $this->constraintParameterParser->parseSyntaxClarificationParameter(
84 84
 			$constraintParameters,
85 85
 			WikibaseRepo::getDefaultInstance()->getUserLanguage() // TODO make this part of the Context?
86 86
 		);
87
-		if ( $syntaxClarification !== null ) {
88
-			$parameters['clarification'] = [ $syntaxClarification ];
87
+		if ($syntaxClarification !== null) {
88
+			$parameters['clarification'] = [$syntaxClarification];
89 89
 		}
90 90
 
91 91
 		$snak = $context->getSnak();
92 92
 
93
-		if ( !$snak instanceof PropertyValueSnak ) {
93
+		if (!$snak instanceof PropertyValueSnak) {
94 94
 			// nothing to check
95
-			return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE, '' );
95
+			return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_COMPLIANCE, '');
96 96
 		}
97 97
 
98 98
 		$dataValue = $snak->getDataValue();
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		 * error handling:
102 102
 		 *   type of $dataValue for properties with 'Format' constraint has to be 'string' or 'monolingualtext'
103 103
 		 */
104
-		switch ( $dataValue->getType() ) {
104
+		switch ($dataValue->getType()) {
105 105
 			case 'string':
106 106
 				$text = $dataValue->getValue();
107 107
 				break;
@@ -109,60 +109,59 @@  discard block
 block discarded – undo
109 109
 				$text = $dataValue->getText();
110 110
 				break;
111 111
 			default:
112
-				$message = wfMessage( "wbqc-violation-message-value-needed-of-type" )
112
+				$message = wfMessage("wbqc-violation-message-value-needed-of-type")
113 113
 						 ->rawParams(
114
-							 $this->constraintParameterRenderer->formatItemId( $constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM ),
115
-							 wfMessage( 'datatypes-type-string' )->escaped(),
116
-							 wfMessage( 'datatypes-type-monolingualtext' )->escaped()
114
+							 $this->constraintParameterRenderer->formatItemId($constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM),
115
+							 wfMessage('datatypes-type-string')->escaped(),
116
+							 wfMessage('datatypes-type-monolingualtext')->escaped()
117 117
 						 )
118 118
 						 ->escaped();
119
-				return new CheckResult( $context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message );
119
+				return new CheckResult($context, $constraint, $parameters, CheckResult::STATUS_VIOLATION, $message);
120 120
 		}
121 121
 
122
-		if ( $this->sparqlHelper !== null && $this->config->get( 'WBQualityConstraintsCheckFormatConstraint' ) ) {
123
-			if ( $this->sparqlHelper->matchesRegularExpression( $text, $format ) ) {
122
+		if ($this->sparqlHelper !== null && $this->config->get('WBQualityConstraintsCheckFormatConstraint')) {
123
+			if ($this->sparqlHelper->matchesRegularExpression($text, $format)) {
124 124
 				$message = '';
125 125
 				$status = CheckResult::STATUS_COMPLIANCE;
126 126
 			} else {
127 127
 				$message = wfMessage(
128 128
 					$syntaxClarification !== null ?
129
-						'wbqc-violation-message-format-clarification' :
130
-						'wbqc-violation-message-format'
129
+						'wbqc-violation-message-format-clarification' : 'wbqc-violation-message-format'
131 130
 				)->rawParams(
132
-					$this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ),
133
-					$this->constraintParameterRenderer->formatDataValue( new StringValue( $text ), Role::OBJECT ),
134
-					$this->constraintParameterRenderer->formatByRole( Role::CONSTRAINT_PARAMETER_VALUE,
135
-						'<code><nowiki>' . htmlspecialchars( $format ) . '</nowiki></code>' )
131
+					$this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY),
132
+					$this->constraintParameterRenderer->formatDataValue(new StringValue($text), Role::OBJECT),
133
+					$this->constraintParameterRenderer->formatByRole(Role::CONSTRAINT_PARAMETER_VALUE,
134
+						'<code><nowiki>'.htmlspecialchars($format).'</nowiki></code>')
136 135
 				);
137
-				if ( $syntaxClarification !== null ) {
138
-					$message->params( $syntaxClarification );
136
+				if ($syntaxClarification !== null) {
137
+					$message->params($syntaxClarification);
139 138
 				}
140 139
 				$message = $message->escaped();
141 140
 				$status = CheckResult::STATUS_VIOLATION;
142 141
 			}
143 142
 		} else {
144
-			$message = wfMessage( "wbqc-violation-message-security-reason" )
145
-					 ->rawParams( $this->constraintParameterRenderer->formatItemId( $constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM ) )
143
+			$message = wfMessage("wbqc-violation-message-security-reason")
144
+					 ->rawParams($this->constraintParameterRenderer->formatItemId($constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM))
146 145
 					 ->escaped();
147 146
 			$status = CheckResult::STATUS_TODO;
148 147
 		}
149
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
148
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
150 149
 	}
151 150
 
152
-	public function checkConstraintParameters( Constraint $constraint ) {
151
+	public function checkConstraintParameters(Constraint $constraint) {
153 152
 		$constraintParameters = $constraint->getConstraintParameters();
154 153
 		$exceptions = [];
155 154
 		try {
156
-			$this->constraintParameterParser->parseFormatParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
157
-		} catch ( ConstraintParameterException $e ) {
155
+			$this->constraintParameterParser->parseFormatParameter($constraintParameters, $constraint->getConstraintTypeItemId());
156
+		} catch (ConstraintParameterException $e) {
158 157
 			$exceptions[] = $e;
159 158
 		}
160 159
 		try {
161 160
 			$this->constraintParameterParser->parseSyntaxClarificationParameter(
162 161
 				$constraintParameters,
163
-				Language::factory( 'en' ) // errors are reported independent of language requested
162
+				Language::factory('en') // errors are reported independent of language requested
164 163
 			);
165
-		} catch ( ConstraintParameterException $e ) {
164
+		} catch (ConstraintParameterException $e) {
166 165
 			$exceptions[] = $e;
167 166
 		}
168 167
 		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
@@ -14,16 +14,16 @@
 block discarded – undo
14 14
  */
15 15
 class ValueOnlyChecker implements ConstraintChecker {
16 16
 
17
-	public function checkConstraint( Context $context, Constraint $constraint ) {
18
-		if ( $context->getType() === Context::TYPE_STATEMENT ) {
19
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE, '' );
17
+	public function checkConstraint(Context $context, Constraint $constraint) {
18
+		if ($context->getType() === Context::TYPE_STATEMENT) {
19
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE, '');
20 20
 		} else {
21
-			$message = wfMessage( 'wbqc-violation-message-valueOnly' )->escaped();
22
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
21
+			$message = wfMessage('wbqc-violation-message-valueOnly')->escaped();
22
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
23 23
 		}
24 24
 	}
25 25
 
26
-	public function checkConstraintParameters( Constraint $constraint ) {
26
+	public function checkConstraintParameters(Constraint $constraint) {
27 27
 		// no parameters
28 28
 		return [];
29 29
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/QualifiersChecker.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -52,46 +52,46 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return CheckResult
54 54
 	 */
55
-	public function checkConstraint( Context $context, Constraint $constraint ) {
56
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
57
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
55
+	public function checkConstraint(Context $context, Constraint $constraint) {
56
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
57
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
58 58
 		}
59
-		if ( $context->getType() !== Context::TYPE_STATEMENT ) {
60
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_NOT_MAIN_SNAK );
59
+		if ($context->getType() !== Context::TYPE_STATEMENT) {
60
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_NOT_MAIN_SNAK);
61 61
 		}
62 62
 
63 63
 		$parameters = [];
64 64
 		$constraintParameters = $constraint->getConstraintParameters();
65 65
 
66
-		$properties = $this->constraintParameterParser->parsePropertiesParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
66
+		$properties = $this->constraintParameterParser->parsePropertiesParameter($constraintParameters, $constraint->getConstraintTypeItemId());
67 67
 		$parameters['property'] = $properties;
68 68
 
69 69
 		$message = '';
70 70
 		$status = CheckResult::STATUS_COMPLIANCE;
71 71
 
72 72
 		/** @var Snak $qualifier */
73
-		foreach ( $context->getSnakStatement()->getQualifiers() as $qualifier ) {
73
+		foreach ($context->getSnakStatement()->getQualifiers() as $qualifier) {
74 74
 			$allowedQualifier = false;
75
-			foreach ( $properties as $property ) {
76
-				if ( $qualifier->getPropertyId()->equals( $property ) ) {
75
+			foreach ($properties as $property) {
76
+				if ($qualifier->getPropertyId()->equals($property)) {
77 77
 					$allowedQualifier = true;
78 78
 					break;
79 79
 				}
80 80
 			}
81
-			if ( !$allowedQualifier ) {
82
-				if ( empty( $properties ) || $properties === [ '' ] ) {
83
-					$message = wfMessage( 'wbqc-violation-message-no-qualifiers' );
81
+			if (!$allowedQualifier) {
82
+				if (empty($properties) || $properties === ['']) {
83
+					$message = wfMessage('wbqc-violation-message-no-qualifiers');
84 84
 					$message->rawParams(
85
-						$this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY )
85
+						$this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY)
86 86
 					);
87 87
 				} else {
88
-					$message = wfMessage( "wbqc-violation-message-qualifiers" );
88
+					$message = wfMessage("wbqc-violation-message-qualifiers");
89 89
 					$message->rawParams(
90
-						$this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ),
91
-						$this->constraintParameterRenderer->formatEntityId( $qualifier->getPropertyId(), Role::QUALIFIER_PREDICATE )
90
+						$this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY),
91
+						$this->constraintParameterRenderer->formatEntityId($qualifier->getPropertyId(), Role::QUALIFIER_PREDICATE)
92 92
 					);
93
-					$message->numParams( count( $properties ) );
94
-					$message->rawParams( $this->constraintParameterRenderer->formatPropertyIdList( $properties, Role::QUALIFIER_PREDICATE ) );
93
+					$message->numParams(count($properties));
94
+					$message->rawParams($this->constraintParameterRenderer->formatPropertyIdList($properties, Role::QUALIFIER_PREDICATE));
95 95
 				}
96 96
 				$message = $message->escaped();
97 97
 				$status = CheckResult::STATUS_VIOLATION;
@@ -99,15 +99,15 @@  discard block
 block discarded – undo
99 99
 			}
100 100
 		}
101 101
 
102
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
102
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
103 103
 	}
104 104
 
105
-	public function checkConstraintParameters( Constraint $constraint ) {
105
+	public function checkConstraintParameters(Constraint $constraint) {
106 106
 		$constraintParameters = $constraint->getConstraintParameters();
107 107
 		$exceptions = [];
108 108
 		try {
109
-			$this->constraintParameterParser->parsePropertiesParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
110
-		} catch ( ConstraintParameterException $e ) {
109
+			$this->constraintParameterParser->parsePropertiesParameter($constraintParameters, $constraint->getConstraintTypeItemId());
110
+		} catch (ConstraintParameterException $e) {
111 111
 			$exceptions[] = $e;
112 112
 		}
113 113
 		return $exceptions;
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
@@ -14,16 +14,16 @@
 block discarded – undo
14 14
  */
15 15
 class ReferenceChecker implements ConstraintChecker {
16 16
 
17
-	public function checkConstraint( Context $context, Constraint $constraint ) {
18
-		if ( $context->getType() === Context::TYPE_REFERENCE ) {
19
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE, '' );
17
+	public function checkConstraint(Context $context, Constraint $constraint) {
18
+		if ($context->getType() === Context::TYPE_REFERENCE) {
19
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE, '');
20 20
 		} else {
21
-			$message = wfMessage( 'wbqc-violation-message-reference' )->escaped();
22
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
21
+			$message = wfMessage('wbqc-violation-message-reference')->escaped();
22
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
23 23
 		}
24 24
 	}
25 25
 
26
-	public function checkConstraintParameters( Constraint $constraint ) {
26
+	public function checkConstraintParameters(Constraint $constraint) {
27 27
 		// no parameters
28 28
 		return [];
29 29
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/QualifierChecker.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,16 +28,16 @@
 block discarded – undo
28 28
 	 *
29 29
 	 * @return CheckResult
30 30
 	 */
31
-	public function checkConstraint( Context $context, Constraint $constraint ) {
32
-		if ( $context->getType() === Context::TYPE_QUALIFIER ) {
33
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE, '' );
31
+	public function checkConstraint(Context $context, Constraint $constraint) {
32
+		if ($context->getType() === Context::TYPE_QUALIFIER) {
33
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE, '');
34 34
 		} else {
35
-			$message = wfMessage( 'wbqc-violation-message-qualifier' )->escaped();
36
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_VIOLATION, $message );
35
+			$message = wfMessage('wbqc-violation-message-qualifier')->escaped();
36
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_VIOLATION, $message);
37 37
 		}
38 38
 	}
39 39
 
40
-	public function checkConstraintParameters( Constraint $constraint ) {
40
+	public function checkConstraintParameters(Constraint $constraint) {
41 41
 		// no parameters
42 42
 		return [];
43 43
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/OneOfChecker.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -51,43 +51,43 @@
 block discarded – undo
51 51
 	 *
52 52
 	 * @return CheckResult
53 53
 	 */
54
-	public function checkConstraint( Context $context, Constraint $constraint ) {
55
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
56
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
54
+	public function checkConstraint(Context $context, Constraint $constraint) {
55
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
56
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
57 57
 		}
58 58
 
59 59
 		$parameters = [];
60 60
 		$constraintParameters = $constraint->getConstraintParameters();
61 61
 
62
-		$items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), true );
62
+		$items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), true);
63 63
 		$parameters['item'] = $items;
64 64
 
65 65
 		$snak = $context->getSnak();
66 66
 
67
-		$message = wfMessage( 'wbqc-violation-message-one-of' );
68
-		$message->rawParams( $this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::PREDICATE ) );
69
-		$message->numParams( count( $items ) );
70
-		$message->rawParams( $this->constraintParameterRenderer->formatItemIdSnakValueList( $items, Role::OBJECT ) );
67
+		$message = wfMessage('wbqc-violation-message-one-of');
68
+		$message->rawParams($this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::PREDICATE));
69
+		$message->numParams(count($items));
70
+		$message->rawParams($this->constraintParameterRenderer->formatItemIdSnakValueList($items, Role::OBJECT));
71 71
 		$message = $message->escaped();
72 72
 		$status = CheckResult::STATUS_VIOLATION;
73 73
 
74
-		foreach ( $items as $item ) {
75
-			if ( $item->matchesSnak( $snak ) ) {
74
+		foreach ($items as $item) {
75
+			if ($item->matchesSnak($snak)) {
76 76
 				$message = '';
77 77
 				$status = CheckResult::STATUS_COMPLIANCE;
78 78
 				break;
79 79
 			}
80 80
 		}
81 81
 
82
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
82
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
83 83
 	}
84 84
 
85
-	public function checkConstraintParameters( Constraint $constraint ) {
85
+	public function checkConstraintParameters(Constraint $constraint) {
86 86
 		$constraintParameters = $constraint->getConstraintParameters();
87 87
 		$exceptions = [];
88 88
 		try {
89
-			$this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), true );
90
-		} catch ( ConstraintParameterException $e ) {
89
+			$this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), true);
90
+		} catch (ConstraintParameterException $e) {
91 91
 			$exceptions[] = $e;
92 92
 		}
93 93
 		return $exceptions;
Please login to merge, or discard this patch.
src/ConstraintCheck/Helper/SparqlHelperException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
 class SparqlHelperException extends RuntimeException {
11 11
 
12 12
 	public function __construct() {
13
-		parent::__construct( 'The SPARQL query endpoint returned an error.' );
13
+		parent::__construct('The SPARQL query endpoint returned an error.');
14 14
 	}
15 15
 
16 16
 }
Please login to merge, or discard this patch.