Completed
Push — master ( ef4bdf...85494b )
by
unknown
39s
created
src/Api/CheckConstraints.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 		CheckResultsRendererFactory $checkResultsRendererFactory,
118 118
 		IBufferingStatsdDataFactory $dataFactory
119 119
 	) {
120
-		parent::__construct( $main, $name );
120
+		parent::__construct($main, $name);
121 121
 		$this->entityIdParser = $entityIdParser;
122 122
 		$this->statementGuidValidator = $statementGuidValidator;
123
-		$this->resultBuilder = $apiHelperFactory->getResultBuilder( $this );
124
-		$this->errorReporter = $apiHelperFactory->getErrorReporter( $this );
123
+		$this->resultBuilder = $apiHelperFactory->getResultBuilder($this);
124
+		$this->errorReporter = $apiHelperFactory->getErrorReporter($this);
125 125
 		$this->resultsSource = $resultsSource;
126 126
 		$this->checkResultsRendererFactory = $checkResultsRendererFactory;
127 127
 		$this->dataFactory = $dataFactory;
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 
138 138
 		$params = $this->extractRequestParams();
139 139
 
140
-		$this->validateParameters( $params );
141
-		$entityIds = $this->parseEntityIds( $params );
142
-		$claimIds = $this->parseClaimIds( $params );
140
+		$this->validateParameters($params);
141
+		$entityIds = $this->parseEntityIds($params);
142
+		$claimIds = $this->parseClaimIds($params);
143 143
 		$constraintIDs = $params[self::PARAM_CONSTRAINT_ID];
144 144
 		$statuses = $params[self::PARAM_STATUS];
145 145
 
146 146
 		$checkResultsRenderer = $this->checkResultsRendererFactory
147
-			->getCheckResultsRenderer( $this->getLanguage() );
147
+			->getCheckResultsRenderer($this->getLanguage());
148 148
 
149 149
 		$this->getResult()->addValue(
150 150
 			null,
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 				)
159 159
 			)->getArray()
160 160
 		);
161
-		$this->resultBuilder->markSuccess( 1 );
161
+		$this->resultBuilder->markSuccess(1);
162 162
 	}
163 163
 
164 164
 	/**
@@ -166,24 +166,24 @@  discard block
 block discarded – undo
166 166
 	 *
167 167
 	 * @return EntityId[]
168 168
 	 */
169
-	private function parseEntityIds( array $params ) {
169
+	private function parseEntityIds(array $params) {
170 170
 		$ids = $params[self::PARAM_ID];
171 171
 
172
-		if ( $ids === null ) {
172
+		if ($ids === null) {
173 173
 			return [];
174
-		} elseif ( $ids === [] ) {
174
+		} elseif ($ids === []) {
175 175
 			$this->errorReporter->dieError(
176
-				'If ' . self::PARAM_ID . ' is specified, it must be nonempty.', 'no-data' );
176
+				'If '.self::PARAM_ID.' is specified, it must be nonempty.', 'no-data' );
177 177
 		}
178 178
 
179
-		return array_map( function ( $id ) {
179
+		return array_map(function($id) {
180 180
 			try {
181
-				return $this->entityIdParser->parse( $id );
182
-			} catch ( EntityIdParsingException $e ) {
181
+				return $this->entityIdParser->parse($id);
182
+			} catch (EntityIdParsingException $e) {
183 183
 				$this->errorReporter->dieError(
184
-					"Invalid id: $id", 'invalid-entity-id', 0, [ self::PARAM_ID => $id ] );
184
+					"Invalid id: $id", 'invalid-entity-id', 0, [self::PARAM_ID => $id] );
185 185
 			}
186
-		}, $ids );
186
+		}, $ids);
187 187
 	}
188 188
 
189 189
 	/**
@@ -191,35 +191,35 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @return string[]
193 193
 	 */
194
-	private function parseClaimIds( array $params ) {
194
+	private function parseClaimIds(array $params) {
195 195
 		$ids = $params[self::PARAM_CLAIM_ID];
196 196
 
197
-		if ( $ids === null ) {
197
+		if ($ids === null) {
198 198
 			return [];
199
-		} elseif ( $ids === [] ) {
199
+		} elseif ($ids === []) {
200 200
 			$this->errorReporter->dieError(
201
-				'If ' . self::PARAM_CLAIM_ID . ' is specified, it must be nonempty.', 'no-data' );
201
+				'If '.self::PARAM_CLAIM_ID.' is specified, it must be nonempty.', 'no-data' );
202 202
 		}
203 203
 
204
-		foreach ( $ids as $id ) {
205
-			if ( !$this->statementGuidValidator->validate( $id ) ) {
204
+		foreach ($ids as $id) {
205
+			if (!$this->statementGuidValidator->validate($id)) {
206 206
 				$this->errorReporter->dieError(
207
-					"Invalid claim id: $id", 'invalid-guid', 0, [ self::PARAM_CLAIM_ID => $id ] );
207
+					"Invalid claim id: $id", 'invalid-guid', 0, [self::PARAM_CLAIM_ID => $id] );
208 208
 			}
209 209
 		}
210 210
 
211 211
 		return $ids;
212 212
 	}
213 213
 
214
-	private function validateParameters( array $params ) {
215
-		if ( $params[self::PARAM_CONSTRAINT_ID] !== null
216
-			 && empty( $params[self::PARAM_CONSTRAINT_ID] )
214
+	private function validateParameters(array $params) {
215
+		if ($params[self::PARAM_CONSTRAINT_ID] !== null
216
+			 && empty($params[self::PARAM_CONSTRAINT_ID])
217 217
 		) {
218 218
 			$paramConstraintId = self::PARAM_CONSTRAINT_ID;
219 219
 			$this->errorReporter->dieError(
220 220
 				"If $paramConstraintId is specified, it must be nonempty.", 'no-data' );
221 221
 		}
222
-		if ( $params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null ) {
222
+		if ($params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null) {
223 223
 			$paramId = self::PARAM_ID;
224 224
 			$paramClaimId = self::PARAM_CLAIM_ID;
225 225
 			$this->errorReporter->dieError(
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 				],
261 261
 				ParamValidator::PARAM_ISMULTI => true,
262 262
 				ParamValidator::PARAM_ALL => true,
263
-				ParamValidator::PARAM_DEFAULT => implode( '|', CachingResultsSource::CACHED_STATUSES ),
263
+				ParamValidator::PARAM_DEFAULT => implode('|', CachingResultsSource::CACHED_STATUSES),
264 264
 				ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
265 265
 			],
266 266
 		];
Please login to merge, or discard this patch.