@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | |
87 | 87 | $language = $repo->getUserLanguage(); |
88 | 88 | $formatterOptions = new FormatterOptions(); |
89 | - $formatterOptions->setOption( SnakFormatter::OPT_LANG, $language->getCode() ); |
|
90 | - $valueFormatter = $valueFormatterFactory->getValueFormatter( SnakFormatter::FORMAT_HTML, $formatterOptions ); |
|
89 | + $formatterOptions->setOption(SnakFormatter::OPT_LANG, $language->getCode()); |
|
90 | + $valueFormatter = $valueFormatterFactory->getValueFormatter(SnakFormatter::FORMAT_HTML, $formatterOptions); |
|
91 | 91 | |
92 | 92 | $entityIdHtmlLinkFormatterFactory = $repo->getEntityIdHtmlLinkFormatterFactory(); |
93 | - $entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter( $language ); |
|
93 | + $entityIdHtmlLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter($language); |
|
94 | 94 | $entityIdLabelFormatterFactory = new EntityIdLabelFormatterFactory(); |
95 | - $entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter( $language ); |
|
95 | + $entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter($language); |
|
96 | 96 | |
97 | 97 | $checkResultsRenderer = new CheckResultsRenderer( |
98 | 98 | $entityTitleLookup, |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $name, |
111 | 111 | $entityIdParser, |
112 | 112 | $statementGuidValidator, |
113 | - $repo->getApiHelperFactory( RequestContext::getMain() ), |
|
113 | + $repo->getApiHelperFactory(RequestContext::getMain()), |
|
114 | 114 | $resultsSource, |
115 | 115 | $checkResultsRenderer, |
116 | 116 | $dataFactory |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | CheckResultsRenderer $checkResultsRenderer, |
138 | 138 | IBufferingStatsdDataFactory $dataFactory |
139 | 139 | ) { |
140 | - parent::__construct( $main, $name ); |
|
140 | + parent::__construct($main, $name); |
|
141 | 141 | $this->entityIdParser = $entityIdParser; |
142 | 142 | $this->statementGuidValidator = $statementGuidValidator; |
143 | - $this->resultBuilder = $apiHelperFactory->getResultBuilder( $this ); |
|
144 | - $this->errorReporter = $apiHelperFactory->getErrorReporter( $this ); |
|
143 | + $this->resultBuilder = $apiHelperFactory->getResultBuilder($this); |
|
144 | + $this->errorReporter = $apiHelperFactory->getErrorReporter($this); |
|
145 | 145 | $this->resultsSource = $resultsSource; |
146 | 146 | $this->checkResultsRenderer = $checkResultsRenderer; |
147 | 147 | $this->dataFactory = $dataFactory; |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | |
158 | 158 | $params = $this->extractRequestParams(); |
159 | 159 | |
160 | - $this->validateParameters( $params ); |
|
161 | - $entityIds = $this->parseEntityIds( $params ); |
|
162 | - $claimIds = $this->parseClaimIds( $params ); |
|
160 | + $this->validateParameters($params); |
|
161 | + $entityIds = $this->parseEntityIds($params); |
|
162 | + $claimIds = $this->parseClaimIds($params); |
|
163 | 163 | $constraintIDs = $params[self::PARAM_CONSTRAINT_ID]; |
164 | 164 | $statuses = $params[self::PARAM_STATUS]; |
165 | 165 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | ) |
176 | 176 | )->getArray() |
177 | 177 | ); |
178 | - $this->resultBuilder->markSuccess( 1 ); |
|
178 | + $this->resultBuilder->markSuccess(1); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -183,24 +183,24 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @return EntityId[] |
185 | 185 | */ |
186 | - private function parseEntityIds( array $params ) { |
|
186 | + private function parseEntityIds(array $params) { |
|
187 | 187 | $ids = $params[self::PARAM_ID]; |
188 | 188 | |
189 | - if ( $ids === null ) { |
|
189 | + if ($ids === null) { |
|
190 | 190 | return []; |
191 | - } elseif ( $ids === [] ) { |
|
191 | + } elseif ($ids === []) { |
|
192 | 192 | $this->errorReporter->dieError( |
193 | - 'If ' . self::PARAM_ID . ' is specified, it must be nonempty.', 'no-data' ); |
|
193 | + 'If '.self::PARAM_ID.' is specified, it must be nonempty.', 'no-data' ); |
|
194 | 194 | } |
195 | 195 | |
196 | - return array_map( function ( $id ) { |
|
196 | + return array_map(function($id) { |
|
197 | 197 | try { |
198 | - return $this->entityIdParser->parse( $id ); |
|
199 | - } catch ( EntityIdParsingException $e ) { |
|
198 | + return $this->entityIdParser->parse($id); |
|
199 | + } catch (EntityIdParsingException $e) { |
|
200 | 200 | $this->errorReporter->dieError( |
201 | - "Invalid id: $id", 'invalid-entity-id', 0, [ self::PARAM_ID => $id ] ); |
|
201 | + "Invalid id: $id", 'invalid-entity-id', 0, [self::PARAM_ID => $id] ); |
|
202 | 202 | } |
203 | - }, $ids ); |
|
203 | + }, $ids); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | /** |
@@ -208,35 +208,35 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @return string[] |
210 | 210 | */ |
211 | - private function parseClaimIds( array $params ) { |
|
211 | + private function parseClaimIds(array $params) { |
|
212 | 212 | $ids = $params[self::PARAM_CLAIM_ID]; |
213 | 213 | |
214 | - if ( $ids === null ) { |
|
214 | + if ($ids === null) { |
|
215 | 215 | return []; |
216 | - } elseif ( $ids === [] ) { |
|
216 | + } elseif ($ids === []) { |
|
217 | 217 | $this->errorReporter->dieError( |
218 | - 'If ' . self::PARAM_CLAIM_ID . ' is specified, it must be nonempty.', 'no-data' ); |
|
218 | + 'If '.self::PARAM_CLAIM_ID.' is specified, it must be nonempty.', 'no-data' ); |
|
219 | 219 | } |
220 | 220 | |
221 | - foreach ( $ids as $id ) { |
|
222 | - if ( !$this->statementGuidValidator->validate( $id ) ) { |
|
221 | + foreach ($ids as $id) { |
|
222 | + if (!$this->statementGuidValidator->validate($id)) { |
|
223 | 223 | $this->errorReporter->dieError( |
224 | - "Invalid claim id: $id", 'invalid-guid', 0, [ self::PARAM_CLAIM_ID => $id ] ); |
|
224 | + "Invalid claim id: $id", 'invalid-guid', 0, [self::PARAM_CLAIM_ID => $id] ); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | |
228 | 228 | return $ids; |
229 | 229 | } |
230 | 230 | |
231 | - private function validateParameters( array $params ) { |
|
232 | - if ( $params[self::PARAM_CONSTRAINT_ID] !== null |
|
233 | - && empty( $params[self::PARAM_CONSTRAINT_ID] ) |
|
231 | + private function validateParameters(array $params) { |
|
232 | + if ($params[self::PARAM_CONSTRAINT_ID] !== null |
|
233 | + && empty($params[self::PARAM_CONSTRAINT_ID]) |
|
234 | 234 | ) { |
235 | 235 | $paramConstraintId = self::PARAM_CONSTRAINT_ID; |
236 | 236 | $this->errorReporter->dieError( |
237 | 237 | "If $paramConstraintId is specified, it must be nonempty.", 'no-data' ); |
238 | 238 | } |
239 | - if ( $params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null ) { |
|
239 | + if ($params[self::PARAM_ID] === null && $params[self::PARAM_CLAIM_ID] === null) { |
|
240 | 240 | $paramId = self::PARAM_ID; |
241 | 241 | $paramClaimId = self::PARAM_CLAIM_ID; |
242 | 242 | $this->errorReporter->dieError( |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | ], |
278 | 278 | ApiBase::PARAM_ISMULTI => true, |
279 | 279 | ApiBase::PARAM_ALL => true, |
280 | - ApiBase::PARAM_DFLT => implode( '|', CachingResultsSource::CACHED_STATUSES ), |
|
280 | + ApiBase::PARAM_DFLT => implode('|', CachingResultsSource::CACHED_STATUSES), |
|
281 | 281 | ApiBase::PARAM_HELP_MSG_PER_VALUE => [], |
282 | 282 | ], |
283 | 283 | ]; |