Completed
Push — master ( 58f7ad...10c482 )
by
unknown
02:49
created
src/ConstraintCheck/Context/QualifierContext.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		Statement $statement,
22 22
 		Snak $snak
23 23
 	) {
24
-		parent::__construct( $entity, $snak );
24
+		parent::__construct($entity, $snak);
25 25
 		$this->statement = $statement;
26 26
 	}
27 27
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		return self::TYPE_QUALIFIER;
30 30
 	}
31 31
 
32
-	protected function &getMainArray( array &$container ) {
32
+	protected function &getMainArray(array &$container) {
33 33
 		$statementArray = &$this->getStatementArray(
34 34
 			$container,
35 35
 			$this->entity->getId()->getSerialization(),
@@ -37,25 +37,25 @@  discard block
 block discarded – undo
37 37
 			$this->statement->getGuid()
38 38
 		);
39 39
 
40
-		if ( !array_key_exists( 'qualifiers', $statementArray ) ) {
40
+		if (!array_key_exists('qualifiers', $statementArray)) {
41 41
 			$statementArray['qualifiers'] = [];
42 42
 		}
43 43
 		$qualifiersArray = &$statementArray['qualifiers'];
44 44
 
45 45
 		$propertyId = $this->getSnak()->getPropertyId()->getSerialization();
46
-		if ( !array_key_exists( $propertyId, $qualifiersArray ) ) {
46
+		if (!array_key_exists($propertyId, $qualifiersArray)) {
47 47
 			$qualifiersArray[$propertyId] = [];
48 48
 		}
49 49
 		$propertyArray = &$qualifiersArray[$propertyId];
50 50
 
51
-		foreach ( $propertyArray as &$potentialQualifierArray ) {
52
-			if ( $potentialQualifierArray['hash'] === $this->getSnak()->getHash() ) {
51
+		foreach ($propertyArray as &$potentialQualifierArray) {
52
+			if ($potentialQualifierArray['hash'] === $this->getSnak()->getHash()) {
53 53
 				$qualifierArray = &$potentialQualifierArray;
54 54
 				break;
55 55
 			}
56 56
 		}
57
-		if ( !isset( $qualifierArray ) ) {
58
-			$qualifierArray = [ 'hash' => $this->getSnak()->getHash() ];
57
+		if (!isset($qualifierArray)) {
58
+			$qualifierArray = ['hash' => $this->getSnak()->getHash()];
59 59
 			$propertyArray[] = &$qualifierArray;
60 60
 		}
61 61
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Context/ReferenceContext.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		Reference $reference,
29 29
 		Snak $snak
30 30
 	) {
31
-		parent::__construct( $entity, $snak );
31
+		parent::__construct($entity, $snak);
32 32
 		$this->statement = $statement;
33 33
 		$this->reference = $reference;
34 34
 	}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		return self::TYPE_REFERENCE;
38 38
 	}
39 39
 
40
-	protected function &getMainArray( array &$container ) {
40
+	protected function &getMainArray(array &$container) {
41 41
 		$statementArray = &$this->getStatementArray(
42 42
 			$container,
43 43
 			$this->entity->getId()->getSerialization(),
@@ -45,38 +45,38 @@  discard block
 block discarded – undo
45 45
 			$this->statement->getGuid()
46 46
 		);
47 47
 
48
-		if ( !array_key_exists( 'references', $statementArray ) ) {
48
+		if (!array_key_exists('references', $statementArray)) {
49 49
 			$statementArray['references'] = [];
50 50
 		}
51 51
 		$referencesArray = &$statementArray['references'];
52 52
 
53
-		foreach ( $referencesArray as &$potentialReferenceArray ) {
54
-			if ( $potentialReferenceArray['hash'] === $this->reference->getHash() ) {
53
+		foreach ($referencesArray as &$potentialReferenceArray) {
54
+			if ($potentialReferenceArray['hash'] === $this->reference->getHash()) {
55 55
 				$referenceArray = &$potentialReferenceArray;
56 56
 				break;
57 57
 			}
58 58
 		}
59
-		if ( !isset( $referenceArray ) ) {
60
-			$referenceArray = [ 'hash' => $this->reference->getHash(), 'snaks' => [] ];
59
+		if (!isset($referenceArray)) {
60
+			$referenceArray = ['hash' => $this->reference->getHash(), 'snaks' => []];
61 61
 			$referencesArray[] = &$referenceArray;
62 62
 		}
63 63
 
64 64
 		$snaksArray = &$referenceArray['snaks'];
65 65
 
66 66
 		$propertyId = $this->getSnak()->getPropertyId()->getSerialization();
67
-		if ( !array_key_exists( $propertyId, $snaksArray ) ) {
67
+		if (!array_key_exists($propertyId, $snaksArray)) {
68 68
 			$snaksArray[$propertyId] = [];
69 69
 		}
70 70
 		$propertyArray = &$snaksArray[$propertyId];
71 71
 
72
-		foreach ( $propertyArray as &$potentialSnakArray ) {
73
-			if ( $potentialSnakArray['hash'] === $this->getSnak()->getHash() ) {
72
+		foreach ($propertyArray as &$potentialSnakArray) {
73
+			if ($potentialSnakArray['hash'] === $this->getSnak()->getHash()) {
74 74
 				$snakArray = &$potentialSnakArray;
75 75
 				break;
76 76
 			}
77 77
 		}
78
-		if ( !isset( $snakArray ) ) {
79
-			$snakArray = [ 'hash' => $this->getSnak()->getHash() ];
78
+		if (!isset($snakArray)) {
79
+			$snakArray = ['hash' => $this->getSnak()->getHash()];
80 80
 			$propertyArray[] = &$snakArray;
81 81
 		}
82 82
 
Please login to merge, or discard this patch.
src/ConstraintCheck/Result/NullResult.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,22 +25,22 @@
 block discarded – undo
25 25
 	 */
26 26
 	const NULL_PROPERTY_ID = 'P2147483647';
27 27
 
28
-	public function __construct( Context $context ) {
28
+	public function __construct(Context $context) {
29 29
 		$constraint = new Constraint(
30 30
 			'null',
31
-			new PropertyId( self::NULL_PROPERTY_ID ),
31
+			new PropertyId(self::NULL_PROPERTY_ID),
32 32
 			'none',
33 33
 			[]
34 34
 		);
35
-		parent::__construct( $context, $constraint );
35
+		parent::__construct($context, $constraint);
36 36
 	}
37 37
 
38 38
 	public function getConstraint() {
39
-		throw new DomainException( 'NullResult holds no constraint' );
39
+		throw new DomainException('NullResult holds no constraint');
40 40
 	}
41 41
 
42 42
 	public function getConstraintId() {
43
-		throw new DomainException( 'NullResult holds no constraint' );
43
+		throw new DomainException('NullResult holds no constraint');
44 44
 	}
45 45
 
46 46
 }
Please login to merge, or discard this patch.
src/ConstraintCheck/ConstraintChecker.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 * @throws ConstraintParameterException if the constraint parameters are invalid
23 23
 	 * @throws SparqlHelperException if the checker uses SPARQL and the query times out or some other error occurs
24 24
 	 */
25
-	public function checkConstraint( Context $context, Constraint $constraint );
25
+	public function checkConstraint(Context $context, Constraint $constraint);
26 26
 
27 27
 	/**
28 28
 	 * Check if the constraint parameters of $constraint are valid.
@@ -33,6 +33,6 @@  discard block
 block discarded – undo
33 33
 	 *
34 34
 	 * @return ConstraintParameterException[]
35 35
 	 */
36
-	public function checkConstraintParameters( Constraint $constraint );
36
+	public function checkConstraintParameters(Constraint $constraint);
37 37
 
38 38
 }
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/SingleValueChecker.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-single-value" )->escaped();
53
+		if ($propertyCountArray[$propertyId->getSerialization()] > 1) {
54
+			$message = wfMessage("wbqc-violation-message-single-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/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/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/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.