Completed
Push — master ( 69812e...589c0c )
by
unknown
06:10 queued 01:43
created
src/ConstraintCheck/Checker/ConflictsWithChecker.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -87,18 +87,18 @@  discard block
 block discarded – undo
87 87
 	 * @throws ConstraintParameterException
88 88
 	 * @return CheckResult
89 89
 	 */
90
-	public function checkConstraint( Context $context, Constraint $constraint ) {
91
-		if ( $context->getSnakRank() === Statement::RANK_DEPRECATED ) {
92
-			return new CheckResult( $context, $constraint, [], CheckResult::STATUS_DEPRECATED );
90
+	public function checkConstraint(Context $context, Constraint $constraint) {
91
+		if ($context->getSnakRank() === Statement::RANK_DEPRECATED) {
92
+			return new CheckResult($context, $constraint, [], CheckResult::STATUS_DEPRECATED);
93 93
 		}
94 94
 
95 95
 		$parameters = [];
96 96
 		$constraintParameters = $constraint->getConstraintParameters();
97 97
 
98
-		$propertyId = $this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
99
-		$parameters['property'] = [ $propertyId ];
98
+		$propertyId = $this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
99
+		$parameters['property'] = [$propertyId];
100 100
 
101
-		$items = $this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
101
+		$items = $this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
102 102
 		$parameters['items'] = $items;
103 103
 
104 104
 		/*
@@ -106,15 +106,15 @@  discard block
 block discarded – undo
106 106
 		 *   a) a property only
107 107
 		 *   b) a property and a number of items (each combination of property and item forming an individual claim)
108 108
 		 */
109
-		if ( $items === [] ) {
109
+		if ($items === []) {
110 110
 			$offendingStatement = $this->connectionCheckerHelper->findStatementWithProperty(
111 111
 				$context->getEntity()->getStatements(),
112 112
 				$propertyId
113 113
 			);
114
-			if ( $offendingStatement !== null ) {
115
-				$message = ( new ViolationMessage( 'wbqc-violation-message-conflicts-with-property' ) )
116
-					->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY )
117
-					->withEntityId( $propertyId, Role::PREDICATE );
114
+			if ($offendingStatement !== null) {
115
+				$message = (new ViolationMessage('wbqc-violation-message-conflicts-with-property'))
116
+					->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY)
117
+					->withEntityId($propertyId, Role::PREDICATE);
118 118
 				$status = CheckResult::STATUS_VIOLATION;
119 119
 			} else {
120 120
 				$message = null;
@@ -126,12 +126,12 @@  discard block
 block discarded – undo
126 126
 				$propertyId,
127 127
 				$items
128 128
 			);
129
-			if ( $offendingStatement !== null ) {
130
-				$offendingValue = ItemIdSnakValue::fromSnak( $offendingStatement->getMainSnak() );
131
-				$message = ( new ViolationMessage( 'wbqc-violation-message-conflicts-with-claim' ) )
132
-					->withEntityId( $context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY )
133
-					->withEntityId( $propertyId, Role::PREDICATE )
134
-					->withItemIdSnakValue( $offendingValue, Role::OBJECT );
129
+			if ($offendingStatement !== null) {
130
+				$offendingValue = ItemIdSnakValue::fromSnak($offendingStatement->getMainSnak());
131
+				$message = (new ViolationMessage('wbqc-violation-message-conflicts-with-claim'))
132
+					->withEntityId($context->getSnak()->getPropertyId(), Role::CONSTRAINT_PROPERTY)
133
+					->withEntityId($propertyId, Role::PREDICATE)
134
+					->withItemIdSnakValue($offendingValue, Role::OBJECT);
135 135
 				$status = CheckResult::STATUS_VIOLATION;
136 136
 			} else {
137 137
 				$message = null;
@@ -139,20 +139,20 @@  discard block
 block discarded – undo
139 139
 			}
140 140
 		}
141 141
 
142
-		return new CheckResult( $context, $constraint, $parameters, $status, $message );
142
+		return new CheckResult($context, $constraint, $parameters, $status, $message);
143 143
 	}
144 144
 
145
-	public function checkConstraintParameters( Constraint $constraint ) {
145
+	public function checkConstraintParameters(Constraint $constraint) {
146 146
 		$constraintParameters = $constraint->getConstraintParameters();
147 147
 		$exceptions = [];
148 148
 		try {
149
-			$this->constraintParameterParser->parsePropertyParameter( $constraintParameters, $constraint->getConstraintTypeItemId() );
150
-		} catch ( ConstraintParameterException $e ) {
149
+			$this->constraintParameterParser->parsePropertyParameter($constraintParameters, $constraint->getConstraintTypeItemId());
150
+		} catch (ConstraintParameterException $e) {
151 151
 			$exceptions[] = $e;
152 152
 		}
153 153
 		try {
154
-			$this->constraintParameterParser->parseItemsParameter( $constraintParameters, $constraint->getConstraintTypeItemId(), false );
155
-		} catch ( ConstraintParameterException $e ) {
154
+			$this->constraintParameterParser->parseItemsParameter($constraintParameters, $constraint->getConstraintTypeItemId(), false);
155
+		} catch (ConstraintParameterException $e) {
156 156
 			$exceptions[] = $e;
157 157
 		}
158 158
 		return $exceptions;
Please login to merge, or discard this patch.