Completed
Push — master ( ea1cb0...da43d1 )
by
unknown
04:41 queued 40s
created
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.
src/ConstraintCheck/Helper/ConstraintParameterException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
 	/**
17 17
 	 * @param string $message HTML
18 18
 	 */
19
-	public function __construct( $message ) {
20
-		parent::__construct( $message );
19
+	public function __construct($message) {
20
+		parent::__construct($message);
21 21
 	}
22 22
 
23 23
 }
Please login to merge, or discard this patch.
src/ConstraintCheck/Helper/ValueCountCheckerHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@
 block discarded – undo
24 24
 	 *
25 25
 	 * @return int[]
26 26
 	 */
27
-	public function getPropertyCount( StatementList $statements ) {
28
-		if ( !isset( $this->propertyCount ) ) {
27
+	public function getPropertyCount(StatementList $statements) {
28
+		if (!isset($this->propertyCount)) {
29 29
 			$this->propertyCount = [];
30 30
 
31 31
 			/** @var Statement $statement */
32
-			foreach ( $statements as $statement ) {
32
+			foreach ($statements as $statement) {
33 33
 				$counter = $statement->getRank() === Statement::RANK_DEPRECATED ? 0 : 1;
34
-				if ( array_key_exists( $statement->getPropertyId()->getSerialization(), $this->propertyCount ) ) {
34
+				if (array_key_exists($statement->getPropertyId()->getSerialization(), $this->propertyCount)) {
35 35
 					$this->propertyCount[$statement->getPropertyId()->getSerialization()] += $counter;
36 36
 				} else {
37 37
 					$this->propertyCount[$statement->getPropertyId()->getSerialization()] = $counter;
Please login to merge, or discard this patch.
src/ConstraintCheck/Helper/ConnectionCheckerHelper.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 		StatementList $statementList,
29 29
 		PropertyId $propertyId
30 30
 	) {
31
-		$statementListByPropertyId = $statementList->getByPropertyId( $propertyId );
32
-		if ( $statementListByPropertyId->isEmpty() ) {
31
+		$statementListByPropertyId = $statementList->getByPropertyId($propertyId);
32
+		if ($statementListByPropertyId->isEmpty()) {
33 33
 			return null;
34 34
 		} else {
35 35
 			return $statementListByPropertyId->toArray()[0];
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
 		PropertyId $propertyId,
51 51
 		EntityId $value
52 52
 	) {
53
-		$statementListByPropertyId = $statementList->getByPropertyId( $propertyId );
53
+		$statementListByPropertyId = $statementList->getByPropertyId($propertyId);
54 54
 		/** @var Statement $statement */
55
-		foreach ( $statementListByPropertyId as $statement ) {
55
+		foreach ($statementListByPropertyId as $statement) {
56 56
 			$snak = $statement->getMainSnak();
57
-			if ( $snak->getType() === 'value' ) {
57
+			if ($snak->getType() === 'value') {
58 58
 				$dataValue = $snak->getDataValue();
59 59
 				if (
60 60
 					$dataValue->getType() === 'wikibase-entityid' &&
61
-					$dataValue->getEntityId()->equals( $value )
61
+					$dataValue->getEntityId()->equals($value)
62 62
 				) {
63 63
 					return $statement;
64 64
 				}
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
 		PropertyId $propertyId,
82 82
 		array $values
83 83
 	) {
84
-		$statementListByPropertyId = $statementList->getByPropertyId( $propertyId );
84
+		$statementListByPropertyId = $statementList->getByPropertyId($propertyId);
85 85
 		/** @var Statement $statement */
86
-		foreach ( $statementListByPropertyId as $statement ) {
86
+		foreach ($statementListByPropertyId as $statement) {
87 87
 			$snak = $statement->getMainSnak();
88
-			foreach ( $values as $value ) {
89
-				if ( $value->matchesSnak( $snak ) ) {
88
+			foreach ($values as $value) {
89
+				if ($value->matchesSnak($snak)) {
90 90
 					return $statement;
91 91
 				}
92 92
 			}
Please login to merge, or discard this patch.