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