Completed
Push — master ( 4c5602...13c0ce )
by
unknown
06:07 queued 55s
created
src/ConstraintCheck/Checker/UniqueValueChecker.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -72,22 +72,22 @@  discard block
 block discarded – undo
72 72
 	 * @throws SparqlHelperException if the checker uses SPARQL and the query times out or some other error occurs
73 73
 	 * @return CheckResult
74 74
 	 */
75
-	public function checkConstraint( Context $context, Constraint $constraint ) {
76
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
77
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
75
+	public function checkConstraint(Context $context, Constraint $constraint) {
76
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
77
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
78 78
 		}
79 79
 
80 80
 		$parameters = [];
81 81
 
82
-		if ( $this->sparqlHelper !== null ) {
83
-			if ( $context->getType() === 'statement' ) {
82
+		if ($this->sparqlHelper !== null) {
83
+			if ($context->getType() === 'statement') {
84 84
 				$result = $this->sparqlHelper->findEntitiesWithSameStatement(
85 85
 					$context->getSnakStatement(),
86 86
 					true // ignore deprecated statements
87 87
 				);
88 88
 			} else {
89
-				if ( $context->getSnak()->getType() !== 'value' ) {
90
-					return new CheckResult( $context, $constraint, [], CheckResult::STATUS_COMPLIANCE );
89
+				if ($context->getSnak()->getType() !== 'value') {
90
+					return new CheckResult($context, $constraint, [], CheckResult::STATUS_COMPLIANCE);
91 91
 				}
92 92
 				$result = $this->sparqlHelper->findEntitiesWithSameQualifierOrReference(
93 93
 					$context->getEntity()->getId(),
@@ -100,29 +100,29 @@  discard block
 block discarded – undo
100 100
 			$otherEntities = $result->getArray();
101 101
 			$metadata = $result->getMetadata();
102 102
 
103
-			if ( $otherEntities === [] ) {
103
+			if ($otherEntities === []) {
104 104
 				$status = CheckResult::STATUS_COMPLIANCE;
105 105
 				$message = null;
106 106
 			} else {
107 107
 				$status = CheckResult::STATUS_VIOLATION;
108
-				$message = wfMessage( 'wbqc-violation-message-unique-value' )
109
-						 ->numParams( count( $otherEntities ) )
110
-						 ->rawParams( $this->constraintParameterRenderer->formatEntityIdList( $otherEntities, Role::SUBJECT ) )
108
+				$message = wfMessage('wbqc-violation-message-unique-value')
109
+						 ->numParams(count($otherEntities))
110
+						 ->rawParams($this->constraintParameterRenderer->formatEntityIdList($otherEntities, Role::SUBJECT))
111 111
 						 ->escaped();
112 112
 			}
113 113
 		} else {
114 114
 			$status = CheckResult::STATUS_TODO;
115
-			$message = wfMessage( "wbqc-violation-message-not-yet-implemented" )
116
-					 ->rawParams( $this->constraintParameterRenderer->formatItemId( $constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM ) )
115
+			$message = wfMessage("wbqc-violation-message-not-yet-implemented")
116
+					 ->rawParams($this->constraintParameterRenderer->formatItemId($constraint->getConstraintTypeItemId(), Role::CONSTRAINT_TYPE_ITEM))
117 117
 					 ->escaped();
118 118
 			$metadata = Metadata::blank();
119 119
 		}
120 120
 
121
-		return ( new CheckResult( $context, $constraint, $parameters, $status, $message ) )
122
-			->withMetadata( $metadata );
121
+		return (new CheckResult($context, $constraint, $parameters, $status, $message))
122
+			->withMetadata($metadata);
123 123
 	}
124 124
 
125
-	public function checkConstraintParameters( Constraint $constraint ) {
125
+	public function checkConstraintParameters(Constraint $constraint) {
126 126
 		// no parameters
127 127
 		return [];
128 128
 	}
Please login to merge, or discard this patch.
src/ConstraintCheck/Checker/SingleValueChecker.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return CheckResult
56 56
 	 */
57
-	public function checkConstraint( Context $context, Constraint $constraint ) {
58
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
59
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
57
+	public function checkConstraint(Context $context, Constraint $constraint) {
58
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
59
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
60 60
 		}
61 61
 
62 62
 		$propertyId = $context->getSnak()->getPropertyId();
@@ -68,18 +68,18 @@  discard block
 block discarded – undo
68 68
 			$propertyId
69 69
 		);
70 70
 
71
-		if ( $propertyCount > 1 ) {
72
-			$message = wfMessage( "wbqc-violation-message-single-value" )->escaped();
71
+		if ($propertyCount > 1) {
72
+			$message = wfMessage("wbqc-violation-message-single-value")->escaped();
73 73
 			$status = CheckResult::STATUS_VIOLATION;
74 74
 		} else {
75 75
 			$message = null;
76 76
 			$status = CheckResult::STATUS_COMPLIANCE;
77 77
 		}
78 78
 
79
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
79
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
80 80
 	}
81 81
 
82
-	public function checkConstraintParameters( Constraint $constraint ) {
82
+	public function checkConstraintParameters(Constraint $constraint) {
83 83
 		// no parameters
84 84
 		return [];
85 85
 	}
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
@@ -85,18 +85,18 @@  discard block
 block discarded – undo
85 85
 	 * @throws ConstraintParameterException
86 86
 	 * @return CheckResult
87 87
 	 */
88
-	public function checkConstraint( Context $context, Constraint $constraint ) {
89
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
90
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
88
+	public function checkConstraint(Context $context, Constraint $constraint) {
89
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
90
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
91 91
 		}
92 92
 
93 93
 		$parameters = [];
94 94
 		$constraintParameters = $constraint->getConstraintParameters();
95 95
 
96
-		$propertyId = $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
97
-		$parameters['property'] = [ $propertyId ];
96
+		$propertyId = $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
97
+		$parameters['property'] = [$propertyId];
98 98
 
99
-		$items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
99
+		$items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
100 100
 		$parameters['items'] = $items;
101 101
 
102 102
 		/*
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		 *   a) a property only
105 105
 		 *   b) a property and a number of items (each combination of property and item forming an individual claim)
106 106
 		 */
107
-		if ( $items === [] ) {
107
+		if ($items === []) {
108 108
 			$requiredStatement = $this->connectionCheckerHelper->findStatementWithProperty(
109 109
 				$context->getEntity()->getStatements(),
110 110
 				$propertyId
@@ -117,35 +117,35 @@  discard block
 block discarded – undo
117 117
 			);
118 118
 		}
119 119
 
120
-		if ( $requiredStatement !== null ) {
120
+		if ($requiredStatement !== null) {
121 121
 			$status = CheckResult::STATUS_COMPLIANCE;
122 122
 			$message = null;
123 123
 		} else {
124 124
 			$status = CheckResult::STATUS_VIOLATION;
125
-			$message = wfMessage( 'wbqc-violation-message-item' );
125
+			$message = wfMessage('wbqc-violation-message-item');
126 126
 			$message->rawParams(
127
-				$this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY ),
128
-				$this->constraintParameterRenderer->formatEntityId( $propertyId, Role::PREDICATE )
127
+				$this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY),
128
+				$this->constraintParameterRenderer->formatEntityId($propertyId, Role::PREDICATE)
129 129
 			);
130
-			$message->numParams( count( $items ) );
131
-			$message->rawParams( $this->constraintParameterRenderer->formatItemIdSnakValueList( $items, Role::OBJECT ) );
130
+			$message->numParams(count($items));
131
+			$message->rawParams($this->constraintParameterRenderer->formatItemIdSnakValueList($items, Role::OBJECT));
132 132
 			$message = $message->escaped();
133 133
 		}
134 134
 
135
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
135
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
136 136
 	}
137 137
 
138
-	public function checkConstraintParameters( Constraint $constraint ) {
138
+	public function checkConstraintParameters(Constraint $constraint) {
139 139
 		$constraintParameters = $constraint->getConstraintParameters();
140 140
 		$exceptions = [];
141 141
 		try {
142
-			$this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
143
-		} catch ( ConstraintParameterException $e ) {
142
+			$this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
143
+		} catch (ConstraintParameterException $e) {
144 144
 			$exceptions[] = $e;
145 145
 		}
146 146
 		try {
147
-			$this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
148
-		} catch ( ConstraintParameterException $e ) {
147
+			$this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
148
+		} catch (ConstraintParameterException $e) {
149 149
 			$exceptions[] = $e;
150 150
 		}
151 151
 		return $exceptions;
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
@@ -67,43 +67,43 @@
 block discarded – undo
67 67
 	 * @throws ConstraintParameterException
68 68
 	 * @return CheckResult
69 69
 	 */
70
-	public function checkConstraint( Context $context, Constraint $constraint ) {
71
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
72
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
70
+	public function checkConstraint(Context $context, Constraint $constraint) {
71
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
72
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
73 73
 		}
74 74
 
75 75
 		$parameters = [];
76 76
 		$constraintParameters = $constraint->getConstraintParameters();
77 77
 
78
-		$items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), true );
78
+		$items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), true);
79 79
 		$parameters['item'] = $items;
80 80
 
81 81
 		$snak = $context->getSnak();
82 82
 
83
-		$message = wfMessage( 'wbqc-violation-message-one-of' );
84
-		$message->rawParams( $this->constraintParameterRenderer->formatEntityId( $context->getSnak()->getPropertyId(), Role::PREDICATE ) );
85
-		$message->numParams( count( $items ) );
86
-		$message->rawParams( $this->constraintParameterRenderer->formatItemIdSnakValueList( $items, Role::OBJECT ) );
83
+		$message = wfMessage('wbqc-violation-message-one-of');
84
+		$message->rawParams($this->constraintParameterRenderer->formatEntityId($context->getSnak()->getPropertyId(), Role::PREDICATE));
85
+		$message->numParams(count($items));
86
+		$message->rawParams($this->constraintParameterRenderer->formatItemIdSnakValueList($items, Role::OBJECT));
87 87
 		$message = $message->escaped();
88 88
 		$status = CheckResult::STATUS_VIOLATION;
89 89
 
90
-		foreach ( $items as $item ) {
91
-			if ( $item->matchesSnak( $snak ) ) {
90
+		foreach ($items as $item) {
91
+			if ($item->matchesSnak($snak)) {
92 92
 				$message = null;
93 93
 				$status = CheckResult::STATUS_COMPLIANCE;
94 94
 				break;
95 95
 			}
96 96
 		}
97 97
 
98
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
98
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
99 99
 	}
100 100
 
101
-	public function checkConstraintParameters( Constraint $constraint ) {
101
+	public function checkConstraintParameters(Constraint $constraint) {
102 102
 		$constraintParameters = $constraint->getConstraintParameters();
103 103
 		$exceptions = [];
104 104
 		try {
105
-			$this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), true );
106
-		} catch ( ConstraintParameterException $e ) {
105
+			$this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), true);
106
+		} catch (ConstraintParameterException $e) {
107 107
 			$exceptions[] = $e;
108 108
 		}
109 109
 		return $exceptions;
Please login to merge, or discard this patch.