Completed
Push — master ( 8287d5...f4362b )
by
unknown
01:50
created
includes/CrossCheck/CrossCheckInteractor.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -288,7 +288,7 @@
 block discarded – undo
288 288
 	}
289 289
 
290 290
 	/**
291
-	 * @param array $strings
291
+	 * @param string[] $strings
292 292
 	 * @param string $parameterName
293 293
 	 *
294 294
 	 * @throws InvalidArgumentException
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	private $crossChecker;
39 39
 
40
-	public function __construct( EntityLookup $entityLookup, StatementGuidParser $statementGuidParser, CrossChecker $crossChecker ) {
40
+	public function __construct(EntityLookup $entityLookup, StatementGuidParser $statementGuidParser, CrossChecker $crossChecker) {
41 41
 		$this->entityLookup = $entityLookup;
42 42
 		$this->statementGuidParser = $statementGuidParser;
43 43
 		$this->crossChecker = $crossChecker;
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 	 *
51 51
 	 * @return CrossCheckResultList|null
52 52
 	 */
53
-	public function crossCheckEntityById( EntityId $entityId ) {
54
-		$entity = $this->entityLookup->getEntity( $entityId );
53
+	public function crossCheckEntityById(EntityId $entityId) {
54
+		$entity = $this->entityLookup->getEntity($entityId);
55 55
 
56
-		if ( $entity instanceof StatementListProvider ) {
57
-			return $this->crossCheckStatements( $entity->getStatements() );
56
+		if ($entity instanceof StatementListProvider) {
57
+			return $this->crossCheckStatements($entity->getStatements());
58 58
 		}
59 59
 
60 60
 		return null;
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 	 *
68 68
 	 * @return CrossCheckResultList[]
69 69
 	 */
70
-	public function crossCheckEntitiesByIds( array $entityIds ) {
71
-		Assert::parameterElementType( EntityId::class,  $entityIds, '$entityIds' );
70
+	public function crossCheckEntitiesByIds(array $entityIds) {
71
+		Assert::parameterElementType(EntityId::class, $entityIds, '$entityIds');
72 72
 
73 73
 		$results = [];
74
-		foreach ( $entityIds as $entityId ) {
75
-			$results[$entityId->getSerialization()] = $this->crossCheckEntityById( $entityId );
74
+		foreach ($entityIds as $entityId) {
75
+			$results[$entityId->getSerialization()] = $this->crossCheckEntityById($entityId);
76 76
 		}
77 77
 
78 78
 		return $results;
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 	 *
86 86
 	 * @return CrossCheckResultList
87 87
 	 */
88
-	public function crossCheckStatements( StatementList $statements ) {
89
-		return $this->crossChecker->crossCheckStatements( $statements, $statements );
88
+	public function crossCheckStatements(StatementList $statements) {
89
+		return $this->crossChecker->crossCheckStatements($statements, $statements);
90 90
 	}
91 91
 
92 92
 	/**
@@ -97,14 +97,14 @@  discard block
 block discarded – undo
97 97
 	 * @return CrossCheckResultList[]
98 98
 	 * @throws InvalidArgumentException
99 99
 	 */
100
-	public function crossCheckEntities( array $entities ) {
101
-		Assert::parameterElementType( EntityDocument::class,  $entities, '$entities' );
100
+	public function crossCheckEntities(array $entities) {
101
+		Assert::parameterElementType(EntityDocument::class, $entities, '$entities');
102 102
 
103 103
 		$results = [];
104
-		foreach ( $entities as $entity ) {
104
+		foreach ($entities as $entity) {
105 105
 			$entityId = $entity->getId()->getSerialization();
106
-			if ( $entity instanceof StatementListProvider ) {
107
-				$results[$entityId] = $this->crossCheckStatements( $entity->getStatements() );
106
+			if ($entity instanceof StatementListProvider) {
107
+				$results[$entityId] = $this->crossCheckStatements($entity->getStatements());
108 108
 			}
109 109
 		}
110 110
 
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 	 * @return CrossCheckResultList|null
121 121
 	 * @throws InvalidArgumentException
122 122
 	 */
123
-	public function crossCheckEntityByIdWithProperties( EntityId $entityId, array $propertyIds ) {
124
-		Assert::parameterElementType( PropertyId::class,  $propertyIds, '$propertyIds' );
123
+	public function crossCheckEntityByIdWithProperties(EntityId $entityId, array $propertyIds) {
124
+		Assert::parameterElementType(PropertyId::class, $propertyIds, '$propertyIds');
125 125
 
126
-		$entity = $this->entityLookup->getEntity( $entityId );
126
+		$entity = $this->entityLookup->getEntity($entityId);
127 127
 
128
-		if ( $entity instanceof StatementListProvider ) {
129
-			return $this->crossCheckStatementsWithProperties( $entity->getStatements(), $propertyIds );
128
+		if ($entity instanceof StatementListProvider) {
129
+			return $this->crossCheckStatementsWithProperties($entity->getStatements(), $propertyIds);
130 130
 		}
131 131
 
132 132
 		return null;
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 	 * @return CrossCheckResultList[]
142 142
 	 * @throws InvalidArgumentException
143 143
 	 */
144
-	public function crossCheckEntitiesByIdWithProperties( array $entityIds, array $propertyIds ) {
145
-		Assert::parameterElementType( EntityId::class,  $entityIds, '$entityIds' );
146
-		Assert::parameterElementType( PropertyId::class,  $propertyIds, '$propertyIds' );
144
+	public function crossCheckEntitiesByIdWithProperties(array $entityIds, array $propertyIds) {
145
+		Assert::parameterElementType(EntityId::class, $entityIds, '$entityIds');
146
+		Assert::parameterElementType(PropertyId::class, $propertyIds, '$propertyIds');
147 147
 
148 148
 		$results = [];
149
-		foreach ( $entityIds as $entityId ) {
150
-			$results[$entityId->getSerialization()] = $this->crossCheckEntityByIdWithProperties( $entityId, $propertyIds );
149
+		foreach ($entityIds as $entityId) {
150
+			$results[$entityId->getSerialization()] = $this->crossCheckEntityByIdWithProperties($entityId, $propertyIds);
151 151
 		}
152 152
 
153 153
 		return $results;
@@ -162,17 +162,17 @@  discard block
 block discarded – undo
162 162
 	 * @return CrossCheckResultList
163 163
 	 * @throws InvalidArgumentException
164 164
 	 */
165
-	public function crossCheckStatementsWithProperties( StatementList $entityStatements, array $propertyIds ) {
166
-		Assert::parameterElementType( PropertyId::class,  $propertyIds, '$propertyIds' );
165
+	public function crossCheckStatementsWithProperties(StatementList $entityStatements, array $propertyIds) {
166
+		Assert::parameterElementType(PropertyId::class, $propertyIds, '$propertyIds');
167 167
 
168 168
 		$statements = new StatementList();
169
-		foreach ( $entityStatements->toArray() as $statement ) {
170
-			if ( in_array( $statement->getPropertyId(), $propertyIds ) ) {
171
-				$statements->addStatement( $statement );
169
+		foreach ($entityStatements->toArray() as $statement) {
170
+			if (in_array($statement->getPropertyId(), $propertyIds)) {
171
+				$statements->addStatement($statement);
172 172
 			}
173 173
 		}
174 174
 
175
-		return $this->crossChecker->crossCheckStatements( $entityStatements, $statements );
175
+		return $this->crossChecker->crossCheckStatements($entityStatements, $statements);
176 176
 	}
177 177
 
178 178
 	/**
@@ -184,14 +184,14 @@  discard block
 block discarded – undo
184 184
 	 * @return CrossCheckResultList[]
185 185
 	 * @throws InvalidArgumentException
186 186
 	 */
187
-	public function crossCheckEntitiesWithProperties( array $entities, array $propertyIds ) {
188
-		Assert::parameterElementType( EntityDocument::class,  $entities, '$entities' );
189
-		Assert::parameterElementType( PropertyId::class,  $propertyIds, '$propertyIds' );
187
+	public function crossCheckEntitiesWithProperties(array $entities, array $propertyIds) {
188
+		Assert::parameterElementType(EntityDocument::class, $entities, '$entities');
189
+		Assert::parameterElementType(PropertyId::class, $propertyIds, '$propertyIds');
190 190
 
191 191
 		$results = [];
192
-		foreach ( $entities as $entity ) {
192
+		foreach ($entities as $entity) {
193 193
 			$entityId = $entity->getId()->getSerialization();
194
-			if ( $entity instanceof StatementListProvider ) {
194
+			if ($entity instanceof StatementListProvider) {
195 195
 				$results[$entityId] = $this->crossCheckStatementsWithProperties(
196 196
 					$entity->getStatements(),
197 197
 					$propertyIds
@@ -210,12 +210,12 @@  discard block
 block discarded – undo
210 210
 	 * @return CrossCheckResultList
211 211
 	 * @throws InvalidArgumentException
212 212
 	 */
213
-	public function crossCheckStatementByGuid( $guid ) {
214
-		$this->assertIsString( $guid, '$guid' );
213
+	public function crossCheckStatementByGuid($guid) {
214
+		$this->assertIsString($guid, '$guid');
215 215
 
216
-		$resultList = $this->crossCheckStatementsByGuids( [ $guid ] );
216
+		$resultList = $this->crossCheckStatementsByGuids([$guid]);
217 217
 
218
-		return reset( $resultList );
218
+		return reset($resultList);
219 219
 	}
220 220
 
221 221
 	/**
@@ -226,21 +226,21 @@  discard block
 block discarded – undo
226 226
 	 * @return CrossCheckResultList[]
227 227
 	 * @throws InvalidArgumentException
228 228
 	 */
229
-	public function crossCheckStatementsByGuids( array $guids ) {
230
-		$this->assertIsArrayOfStrings( $guids, '$guids' );
229
+	public function crossCheckStatementsByGuids(array $guids) {
230
+		$this->assertIsArrayOfStrings($guids, '$guids');
231 231
 
232 232
 		$entityIds = [];
233 233
 		$groupedStatementGuids = [];
234
-		foreach ( $guids as $guid ) {
235
-			$serializedEntityId = $this->statementGuidParser->parse( $guid )->getEntityId();
234
+		foreach ($guids as $guid) {
235
+			$serializedEntityId = $this->statementGuidParser->parse($guid)->getEntityId();
236 236
 			$entityIds[$serializedEntityId->getSerialization()] = $serializedEntityId;
237 237
 			$groupedStatementGuids[$serializedEntityId->getSerialization()][] = $guid;
238 238
 		}
239 239
 
240 240
 		$resultLists = [];
241
-		foreach ( $groupedStatementGuids as $serializedEntityId => $guidsOfEntity ) {
242
-			$entityId = $entityIds[ $serializedEntityId ];
243
-			$resultLists[ $serializedEntityId ] = $this->crossCheckClaimsOfEntity( $entityId, $guidsOfEntity );
241
+		foreach ($groupedStatementGuids as $serializedEntityId => $guidsOfEntity) {
242
+			$entityId = $entityIds[$serializedEntityId];
243
+			$resultLists[$serializedEntityId] = $this->crossCheckClaimsOfEntity($entityId, $guidsOfEntity);
244 244
 		}
245 245
 
246 246
 		return $resultLists;
@@ -252,18 +252,18 @@  discard block
 block discarded – undo
252 252
 	 *
253 253
 	 * @return CrossCheckResultList|null
254 254
 	 */
255
-	private function crossCheckClaimsOfEntity( EntityId $entityId, array $guids ) {
256
-		$entity = $this->entityLookup->getEntity( $entityId );
255
+	private function crossCheckClaimsOfEntity(EntityId $entityId, array $guids) {
256
+		$entity = $this->entityLookup->getEntity($entityId);
257 257
 
258
-		if ( $entity instanceof StatementListProvider ) {
258
+		if ($entity instanceof StatementListProvider) {
259 259
 			$statements = new StatementList();
260
-			foreach ( $entity->getStatements()->toArray() as $statement ) {
261
-				if ( in_array( $statement->getGuid(), $guids ) ) {
262
-					$statements->addStatement( $statement );
260
+			foreach ($entity->getStatements()->toArray() as $statement) {
261
+				if (in_array($statement->getGuid(), $guids)) {
262
+					$statements->addStatement($statement);
263 263
 				}
264 264
 			}
265 265
 
266
-			return $this->crossChecker->crossCheckStatements( $entity->getStatements(), $statements );
266
+			return $this->crossChecker->crossCheckStatements($entity->getStatements(), $statements);
267 267
 		}
268 268
 
269 269
 		return null;
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
 	 *
276 276
 	 * @throws InvalidArgumentException
277 277
 	 */
278
-	private function assertIsString( $string, $parameterName ) {
279
-		if ( !is_string( $string ) ) {
280
-			throw new InvalidArgumentException( "$parameterName must be string." );
278
+	private function assertIsString($string, $parameterName) {
279
+		if (!is_string($string)) {
280
+			throw new InvalidArgumentException("$parameterName must be string.");
281 281
 		}
282 282
 	}
283 283
 
@@ -287,10 +287,10 @@  discard block
 block discarded – undo
287 287
 	 *
288 288
 	 * @throws InvalidArgumentException
289 289
 	 */
290
-	private function assertIsArrayOfStrings( array $strings, $parameterName ) {
291
-		foreach ( $strings as $string ) {
292
-			if ( !is_string( $string ) ) {
293
-				throw new InvalidArgumentException( "Each element of $parameterName must be string." );
290
+	private function assertIsArrayOfStrings(array $strings, $parameterName) {
291
+		foreach ($strings as $string) {
292
+			if (!is_string($string)) {
293
+				throw new InvalidArgumentException("Each element of $parameterName must be string.");
294 294
 			}
295 295
 		}
296 296
 	}
Please login to merge, or discard this patch.
includes/CrossCheck/Comparer/DataValueComparer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 *
19 19
 	 * @return bool
20 20
 	 */
21
-	public function canCompare( DataValue $value, DataValue $comparativeValue );
21
+	public function canCompare(DataValue $value, DataValue $comparativeValue);
22 22
 
23 23
 	/**
24 24
 	 * Runs the comparison of two DataValues.
@@ -28,6 +28,6 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @return string One of the ComparisonResult::STATUS_... constants.
30 30
 	 */
31
-	public function compare( DataValue $value, DataValue $comparativeValue );
31
+	public function compare(DataValue $value, DataValue $comparativeValue);
32 32
 
33 33
 }
Please login to merge, or discard this patch.
includes/CrossCheck/Comparer/GlobeCoordinateValueComparer.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	 * @throws InvalidArgumentException
24 24
 	 * @return string One of the ComparisonResult::STATUS_... constants.
25 25
 	 */
26
-	public function compare( DataValue $value, DataValue $comparativeValue ) {
27
-		if ( !$this->canCompare( $value, $comparativeValue ) ) {
28
-			throw new InvalidArgumentException( 'Given values can not be compared using this comparer.' );
26
+	public function compare(DataValue $value, DataValue $comparativeValue) {
27
+		if (!$this->canCompare($value, $comparativeValue)) {
28
+			throw new InvalidArgumentException('Given values can not be compared using this comparer.');
29 29
 		}
30 30
 
31 31
 		/**
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
 		$extLat = $comparativeValue->getLatitude();
40 40
 		$extLong = $comparativeValue->getLongitude();
41 41
 
42
-		$diffLat = abs( $locLat - $extLat );
43
-		$diffLong = abs( $locLong - $extLong );
44
-		if ( ( $diffLat <= $precision ) && ( $diffLong <= $precision ) ) {
42
+		$diffLat = abs($locLat - $extLat);
43
+		$diffLong = abs($locLong - $extLong);
44
+		if (($diffLat <= $precision) && ($diffLong <= $precision)) {
45 45
 			return ComparisonResult::STATUS_MATCH;
46 46
 		}
47 47
 
48 48
 		$daumen = $precision;
49
-		if ( ( $diffLat <= pi() * $daumen ) && ( $diffLong <= pi() * $daumen ) ) {
49
+		if (($diffLat <= pi() * $daumen) && ($diffLong <= pi() * $daumen)) {
50 50
 			return ComparisonResult::STATUS_PARTIAL_MATCH;
51 51
 		}
52 52
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @param DataValue $comparativeValue
61 61
 	 * @return bool
62 62
 	 */
63
-	public function canCompare( DataValue $value, DataValue $comparativeValue ) {
63
+	public function canCompare(DataValue $value, DataValue $comparativeValue) {
64 64
 		return $value instanceof GlobeCoordinateValue && $comparativeValue instanceof GlobeCoordinateValue;
65 65
 	}
66 66
 
Please login to merge, or discard this patch.
includes/DumpMetaInformation/DumpMetaInformationStore.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
 	 *
16 16
 	 * @param DumpMetaInformation $dumpMetaInformation
17 17
 	 */
18
-	public function save( DumpMetaInformation $dumpMetaInformation );
18
+	public function save(DumpMetaInformation $dumpMetaInformation);
19 19
 
20 20
 }
Please login to merge, or discard this patch.
includes/Serializer/IndexedTagsSerializer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 	 * @param array &$arr
21 21
 	 * @param string $tag
22 22
 	 */
23
-	protected function setIndexedTagName( array &$arr, $tag ) {
24
-		ApiResult::setIndexedTagName( $arr, $tag );
23
+	protected function setIndexedTagName(array &$arr, $tag) {
24
+		ApiResult::setIndexedTagName($arr, $tag);
25 25
 	}
26 26
 
27 27
 	/**
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
 	 * @param string $tagName
34 34
 	 * @param string $idAttribute
35 35
 	 */
36
-	protected function setKeyAttributeName( array &$arr, $tagName, $idAttribute ) {
37
-		ApiResult::setArrayType( $arr, 'kvp', $idAttribute );
38
-		ApiResult::setIndexedTagName( $arr, $tagName );
36
+	protected function setKeyAttributeName(array &$arr, $tagName, $idAttribute) {
37
+		ApiResult::setArrayType($arr, 'kvp', $idAttribute);
38
+		ApiResult::setIndexedTagName($arr, $tagName);
39 39
 	}
40 40
 
41 41
 }
Please login to merge, or discard this patch.
includes/UpdateExternalData/CsvImportSettings.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@
 block discarded – undo
43 43
 	 * @param int $batchSize
44 44
 	 * @param bool $quiet
45 45
 	 */
46
-	public function __construct( $externalValuesFilePath, $dumpInformationFilePath, $batchSize, $quiet = false ) {
47
-		Assert::parameterType( 'string', $externalValuesFilePath, '$externalValuesFilePath' );
48
-		Assert::parameterType( 'string', $dumpInformationFilePath, '$dumpInformationFilePath' );
49
-		Assert::parameterType( 'integer', $batchSize, '$batchSize' );
50
-		Assert::parameterType( 'boolean', $quiet, '$quiet' );
46
+	public function __construct($externalValuesFilePath, $dumpInformationFilePath, $batchSize, $quiet = false) {
47
+		Assert::parameterType('string', $externalValuesFilePath, '$externalValuesFilePath');
48
+		Assert::parameterType('string', $dumpInformationFilePath, '$dumpInformationFilePath');
49
+		Assert::parameterType('integer', $batchSize, '$batchSize');
50
+		Assert::parameterType('boolean', $quiet, '$quiet');
51 51
 
52 52
 		$this->externalValuesFilePath = $externalValuesFilePath;
53 53
 		$this->dumpInformationFilePath = $dumpInformationFilePath;
Please login to merge, or discard this patch.
specials/SpecialCrossCheck.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	/**
307 307
 	 * Builds summary from given results
308 308
 	 *
309
-	 * @param CrossCheckResult[]|CrossCheckResultList $results
309
+	 * @param CrossCheckResultList $results
310 310
 	 *
311 311
 	 * @return string HTML
312 312
 	 */
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	}
397 397
 
398 398
 	/**
399
-	 * @param CrossCheckResult[]|CrossCheckResultList $results
399
+	 * @param CrossCheckResultList $results
400 400
 	 *
401 401
 	 * @return string HTML
402 402
 	 */
Please login to merge, or discard this patch.
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -94,17 +94,17 @@  discard block
 block discarded – undo
94 94
 		OutputFormatValueFormatterFactory $valueFormatterFactory,
95 95
 		CrossCheckInteractor $crossCheckInteractor
96 96
 	) {
97
-		parent::__construct( 'CrossCheck' );
97
+		parent::__construct('CrossCheck');
98 98
 
99 99
 		$this->entityLookup = $entityLookup;
100 100
 		$this->entityIdParser = $entityIdParser;
101 101
 
102 102
 		$formatterOptions = new FormatterOptions();
103
-		$formatterOptions->setOption( SnakFormatter::OPT_LANG, $this->getLanguage()->getCode() );
104
-		$this->dataValueFormatter = $valueFormatterFactory->getValueFormatter( SnakFormatter::FORMAT_HTML, $formatterOptions );
103
+		$formatterOptions->setOption(SnakFormatter::OPT_LANG, $this->getLanguage()->getCode());
104
+		$this->dataValueFormatter = $valueFormatterFactory->getValueFormatter(SnakFormatter::FORMAT_HTML, $formatterOptions);
105 105
 
106
-		$this->entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter( $this->getLanguage() );
107
-		$this->entityIdLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter( $this->getLanguage() );
106
+		$this->entityIdLabelFormatter = $entityIdLabelFormatterFactory->getEntityIdFormatter($this->getLanguage());
107
+		$this->entityIdLinkFormatter = $entityIdHtmlLinkFormatterFactory->getEntityIdFormatter($this->getLanguage());
108 108
 
109 109
 		$this->crossCheckInteractor = $crossCheckInteractor;
110 110
 	}
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @return string (plain text)
125 125
 	 */
126 126
 	public function getDescription() {
127
-		return $this->msg( 'wbqev-crosscheck' )->text();
127
+		return $this->msg('wbqev-crosscheck')->text();
128 128
 	}
129 129
 
130 130
 	/**
@@ -136,55 +136,55 @@  discard block
 block discarded – undo
136 136
 	 * @throws EntityIdParsingException
137 137
 	 * @throws UnexpectedValueException
138 138
 	 */
139
-	public function execute( $subPage ) {
139
+	public function execute($subPage) {
140 140
 		$out = $this->getOutput();
141
-		$postRequest = $this->getContext()->getRequest()->getVal( 'entityid' );
142
-		if ( $postRequest ) {
143
-			$out->redirect( $this->getPageTitle( strtoupper( $postRequest ) )->getLocalURL() );
141
+		$postRequest = $this->getContext()->getRequest()->getVal('entityid');
142
+		if ($postRequest) {
143
+			$out->redirect($this->getPageTitle(strtoupper($postRequest))->getLocalURL());
144 144
 			return;
145 145
 		}
146 146
 
147
-		$out->addModules( 'SpecialCrossCheckPage' );
147
+		$out->addModules('SpecialCrossCheckPage');
148 148
 
149 149
 		$this->setHeaders();
150 150
 
151
-		$out->addHTML( $this->buildInfoBox() );
151
+		$out->addHTML($this->buildInfoBox());
152 152
 		$this->buildEntityIdForm();
153 153
 
154
-		if ( $subPage ) {
155
-			$this->buildResult( $subPage );
154
+		if ($subPage) {
155
+			$this->buildResult($subPage);
156 156
 		}
157 157
 	}
158 158
 
159 159
 	/**
160 160
 	 * @param string $idSerialization
161 161
 	 */
162
-	private function buildResult( $idSerialization ) {
162
+	private function buildResult($idSerialization) {
163 163
 		$out = $this->getOutput();
164 164
 
165 165
 		try {
166
-			$entityId = $this->entityIdParser->parse( $idSerialization );
167
-		} catch ( EntityIdParsingException $ex ) {
168
-			$out->addHTML( $this->buildNotice( 'wbqev-crosscheck-invalid-entity-id', true ) );
166
+			$entityId = $this->entityIdParser->parse($idSerialization);
167
+		} catch (EntityIdParsingException $ex) {
168
+			$out->addHTML($this->buildNotice('wbqev-crosscheck-invalid-entity-id', true));
169 169
 			return;
170 170
 		}
171 171
 
172
-		$out->addHTML( $this->buildResultHeader( $entityId ) );
172
+		$out->addHTML($this->buildResultHeader($entityId));
173 173
 
174
-		$entity = $this->entityLookup->getEntity( $entityId );
175
-		if ( $entity === null ) {
176
-			$out->addHTML( $this->buildNotice( 'wbqev-crosscheck-not-existent-entity', true ) );
174
+		$entity = $this->entityLookup->getEntity($entityId);
175
+		if ($entity === null) {
176
+			$out->addHTML($this->buildNotice('wbqev-crosscheck-not-existent-entity', true));
177 177
 			return;
178 178
 		}
179 179
 
180
-		$results = $this->getCrossCheckResultsFromEntity( $entity );
180
+		$results = $this->getCrossCheckResultsFromEntity($entity);
181 181
 
182
-		if ( $results === null || $results->toArray() === [] ) {
183
-			$out->addHTML( $this->buildNotice( 'wbqev-crosscheck-empty-result' ) );
182
+		if ($results === null || $results->toArray() === []) {
183
+			$out->addHTML($this->buildNotice('wbqev-crosscheck-empty-result'));
184 184
 		} else {
185 185
 			$out->addHTML(
186
-				$this->buildSummary( $results )
187
-				. $this->buildResultTable( $results )
186
+				$this->buildSummary($results)
187
+				. $this->buildResultTable($results)
188 188
 			);
189 189
 		}
190 190
 	}
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
 	 *
195 195
 	 * @return CrossCheckResultList|null
196 196
 	 */
197
-	private function getCrossCheckResultsFromEntity( EntityDocument $entity ) {
198
-		if ( $entity instanceof StatementListProvider ) {
199
-			return $this->crossCheckInteractor->crossCheckStatements( $entity->getStatements() );
197
+	private function getCrossCheckResultsFromEntity(EntityDocument $entity) {
198
+		if ($entity instanceof StatementListProvider) {
199
+			return $this->crossCheckInteractor->crossCheckStatements($entity->getStatements());
200 200
 		}
201 201
 
202 202
 		return null;
@@ -213,15 +213,15 @@  discard block
 block discarded – undo
213 213
 				'name' => 'entityid',
214 214
 				'label-message' => 'wbqev-crosscheck-form-entityid-label',
215 215
 				'cssclass' => 'wbqev-crosscheck-form-entity-id',
216
-				'placeholder' => $this->msg( 'wbqev-crosscheck-form-entityid-placeholder' )->escaped()
216
+				'placeholder' => $this->msg('wbqev-crosscheck-form-entityid-placeholder')->escaped()
217 217
 			]
218 218
 		];
219
-		$htmlForm = new HTMLForm( $formDescriptor, $this->getContext(), 'wbqev-crosscheck-form' );
220
-		$htmlForm->setSubmitText( $this->msg( 'wbqev-crosscheck-form-submit-label' )->escaped() );
221
-		$htmlForm->setSubmitCallback( function() {
219
+		$htmlForm = new HTMLForm($formDescriptor, $this->getContext(), 'wbqev-crosscheck-form');
220
+		$htmlForm->setSubmitText($this->msg('wbqev-crosscheck-form-submit-label')->escaped());
221
+		$htmlForm->setSubmitCallback(function() {
222 222
 			return false;
223 223
 		} );
224
-		$htmlForm->setMethod( 'post' );
224
+		$htmlForm->setMethod('post');
225 225
 		$htmlForm->show();
226 226
 	}
227 227
 
@@ -231,18 +231,18 @@  discard block
 block discarded – undo
231 231
 	 * @return string HTML
232 232
 	 */
233 233
 	private function buildInfoBox() {
234
-		$externalDbLink = Linker::specialLink( 'ExternalDatabases', 'wbqev-externaldbs' );
234
+		$externalDbLink = Linker::specialLink('ExternalDatabases', 'wbqev-externaldbs');
235 235
 		$infoBox =
236 236
 			Html::openElement(
237 237
 				'div',
238
-				[ 'class' => 'wbqev-infobox' ]
238
+				['class' => 'wbqev-infobox']
239 239
 			)
240
-			. $this->msg( 'wbqev-crosscheck-explanation-general' )->parse()
241
-			. sprintf( ' %s.', $externalDbLink )
242
-			. Html::element( 'br' )
243
-			. Html::element( 'br' )
244
-			. $this->msg( 'wbqev-crosscheck-explanation-detail' )->parse()
245
-			. Html::closeElement( 'div' );
240
+			. $this->msg('wbqev-crosscheck-explanation-general')->parse()
241
+			. sprintf(' %s.', $externalDbLink)
242
+			. Html::element('br')
243
+			. Html::element('br')
244
+			. $this->msg('wbqev-crosscheck-explanation-detail')->parse()
245
+			. Html::closeElement('div');
246 246
 
247 247
 		return $infoBox;
248 248
 	}
@@ -257,16 +257,16 @@  discard block
 block discarded – undo
257 257
 	 *
258 258
 	 * @return string HTML
259 259
 	 */
260
-	private function buildNotice( $messageKey, $error = false ) {
260
+	private function buildNotice($messageKey, $error = false) {
261 261
 		$cssClasses = 'wbqev-crosscheck-notice';
262
-		if ( $error ) {
262
+		if ($error) {
263 263
 			$cssClasses .= ' wbqev-crosscheck-notice-error';
264 264
 		}
265 265
 
266 266
 		return Html::element(
267 267
 			'p',
268
-			[ 'class' => $cssClasses ],
269
-			$this->msg( $messageKey )->text()
268
+			['class' => $cssClasses],
269
+			$this->msg($messageKey)->text()
270 270
 		);
271 271
 	}
272 272
 
@@ -277,17 +277,17 @@  discard block
 block discarded – undo
277 277
 	 *
278 278
 	 * @return string HTML
279 279
 	 */
280
-	private function buildResultHeader( EntityId $entityId ) {
280
+	private function buildResultHeader(EntityId $entityId) {
281 281
 		$entityLink = sprintf(
282 282
 			'%s (%s)',
283
-			$this->entityIdLinkFormatter->formatEntityId( $entityId ),
284
-			htmlspecialchars( $entityId->getSerialization() )
283
+			$this->entityIdLinkFormatter->formatEntityId($entityId),
284
+			htmlspecialchars($entityId->getSerialization())
285 285
 		);
286 286
 
287 287
 		return Html::rawElement(
288 288
 			'h3',
289 289
 			[],
290
-			sprintf( '%s %s', $this->msg( 'wbqev-crosscheck-result-headline' )->escaped(), $entityLink )
290
+			sprintf('%s %s', $this->msg('wbqev-crosscheck-result-headline')->escaped(), $entityLink)
291 291
 		);
292 292
 	}
293 293
 
@@ -298,11 +298,11 @@  discard block
 block discarded – undo
298 298
 	 *
299 299
 	 * @return string HTML
300 300
 	 */
301
-	private function buildSummary( $results ) {
301
+	private function buildSummary($results) {
302 302
 		$statuses = [];
303
-		foreach ( $results as $result ) {
304
-			$status = strtolower( $result->getComparisonResult()->getStatus() );
305
-			if ( array_key_exists( $status, $statuses ) ) {
303
+		foreach ($results as $result) {
304
+			$status = strtolower($result->getComparisonResult()->getStatus());
305
+			if (array_key_exists($status, $statuses)) {
306 306
 				$statuses[$status]++;
307 307
 			} else {
308 308
 				$statuses[$status] = 1;
@@ -310,15 +310,15 @@  discard block
 block discarded – undo
310 310
 		}
311 311
 
312 312
 		$statusElements = [];
313
-		foreach ( $statuses as $status => $count ) {
314
-			if ( $count > 0 ) {
315
-				$statusElements[] = $this->formatStatus( $status ) . ': ' . $count;
313
+		foreach ($statuses as $status => $count) {
314
+			if ($count > 0) {
315
+				$statusElements[] = $this->formatStatus($status).': '.$count;
316 316
 			}
317 317
 		}
318 318
 		$summary =
319
-			Html::openElement( 'p' )
320
-			. implode( ', ', $statusElements )
321
-			. Html::closeElement( 'p' );
319
+			Html::openElement('p')
320
+			. implode(', ', $statusElements)
321
+			. Html::closeElement('p');
322 322
 
323 323
 		return $summary;
324 324
 	}
@@ -332,16 +332,16 @@  discard block
 block discarded – undo
332 332
 	 *
333 333
 	 * @return string HTML
334 334
 	 */
335
-	private function formatStatus( $status ) {
336
-		$messageKey = 'wbqev-crosscheck-status-' . strtolower( $status );
335
+	private function formatStatus($status) {
336
+		$messageKey = 'wbqev-crosscheck-status-'.strtolower($status);
337 337
 
338 338
 		$formattedStatus =
339 339
 			Html::element(
340 340
 				'span',
341 341
 				[
342
-					'class' => 'wbqev-status wbqev-status-' . $status
342
+					'class' => 'wbqev-status wbqev-status-'.$status
343 343
 				],
344
-				$this->msg( $messageKey )->text()
344
+				$this->msg($messageKey)->text()
345 345
 			);
346 346
 
347 347
 		return $formattedStatus;
@@ -358,29 +358,29 @@  discard block
 block discarded – undo
358 358
 	 *
359 359
 	 * @return string HTML
360 360
 	 */
361
-	private function formatDataValues( $dataValues, $linking = true, $separator = null ) {
362
-		if ( $dataValues instanceof DataValue ) {
363
-			$dataValues = [ $dataValues ];
361
+	private function formatDataValues($dataValues, $linking = true, $separator = null) {
362
+		if ($dataValues instanceof DataValue) {
363
+			$dataValues = [$dataValues];
364 364
 		}
365 365
 
366 366
 		$formattedDataValues = [];
367
-		foreach ( $dataValues as $dataValue ) {
368
-			if ( $dataValue instanceof EntityIdValue ) {
369
-				if ( $linking ) {
370
-					$formattedDataValues[] = $this->entityIdLinkFormatter->formatEntityId( $dataValue->getEntityId() );
367
+		foreach ($dataValues as $dataValue) {
368
+			if ($dataValue instanceof EntityIdValue) {
369
+				if ($linking) {
370
+					$formattedDataValues[] = $this->entityIdLinkFormatter->formatEntityId($dataValue->getEntityId());
371 371
 				} else {
372
-					$formattedDataValues[] = $this->entityIdLabelFormatter->formatEntityId( $dataValue->getEntityId() );
372
+					$formattedDataValues[] = $this->entityIdLabelFormatter->formatEntityId($dataValue->getEntityId());
373 373
 				}
374 374
 			} else {
375
-				$formattedDataValues[] = $this->dataValueFormatter->format( $dataValue );
375
+				$formattedDataValues[] = $this->dataValueFormatter->format($dataValue);
376 376
 			}
377 377
 		}
378 378
 
379
-		if ( $separator ) {
380
-			return implode( $separator, $formattedDataValues );
379
+		if ($separator) {
380
+			return implode($separator, $formattedDataValues);
381 381
 		}
382 382
 
383
-		return $this->getLanguage()->commaList( $formattedDataValues );
383
+		return $this->getLanguage()->commaList($formattedDataValues);
384 384
 	}
385 385
 
386 386
 	/**
@@ -388,31 +388,31 @@  discard block
 block discarded – undo
388 388
 	 *
389 389
 	 * @return string HTML
390 390
 	 */
391
-	private function buildResultTable( $results ) {
391
+	private function buildResultTable($results) {
392 392
 		$table = new HtmlTableBuilder(
393 393
 			[
394 394
 				new HtmlTableHeaderBuilder(
395
-					$this->msg( 'wbqev-crosscheck-result-table-header-status' )->escaped(),
395
+					$this->msg('wbqev-crosscheck-result-table-header-status')->escaped(),
396 396
 					true
397 397
 				),
398 398
 				new HtmlTableHeaderBuilder(
399
-					$this->msg( 'datatypes-type-wikibase-property' )->escaped(),
399
+					$this->msg('datatypes-type-wikibase-property')->escaped(),
400 400
 					true
401 401
 				),
402 402
 				new HtmlTableHeaderBuilder(
403
-					$this->msg( 'wbqev-crosscheck-result-table-header-local-value' )->escaped()
403
+					$this->msg('wbqev-crosscheck-result-table-header-local-value')->escaped()
404 404
 				),
405 405
 				new HtmlTableHeaderBuilder(
406
-					$this->msg( 'wbqev-crosscheck-result-table-header-external-value' )->escaped()
406
+					$this->msg('wbqev-crosscheck-result-table-header-external-value')->escaped()
407 407
 				),
408 408
 				new HtmlTableHeaderBuilder(
409
-					$this->msg( 'wbqev-crosscheck-result-table-header-references' )->escaped(),
409
+					$this->msg('wbqev-crosscheck-result-table-header-references')->escaped(),
410 410
 					true
411 411
 				),
412 412
 				new HtmlTableHeaderBuilder(
413 413
 					Linker::linkKnown(
414
-						self::getTitleFor( 'ExternalDatabases' ),
415
-						$this->msg( 'wbqev-crosscheck-result-table-header-external-source' )->escaped()
414
+						self::getTitleFor('ExternalDatabases'),
415
+						$this->msg('wbqev-crosscheck-result-table-header-external-source')->escaped()
416 416
 					),
417 417
 					true,
418 418
 					true
@@ -421,28 +421,28 @@  discard block
 block discarded – undo
421 421
 			true
422 422
 		);
423 423
 
424
-		foreach ( $results as $result ) {
425
-			$status = $this->formatStatus( $result->getComparisonResult()->getStatus() );
426
-			$propertyId = $this->entityIdLinkFormatter->formatEntityId( $result->getPropertyId() );
427
-			$localValue = $this->formatDataValues( $result->getComparisonResult()->getLocalValue() );
424
+		foreach ($results as $result) {
425
+			$status = $this->formatStatus($result->getComparisonResult()->getStatus());
426
+			$propertyId = $this->entityIdLinkFormatter->formatEntityId($result->getPropertyId());
427
+			$localValue = $this->formatDataValues($result->getComparisonResult()->getLocalValue());
428 428
 			$externalValue = $this->formatDataValues(
429 429
 				$result->getComparisonResult()->getExternalValues(),
430 430
 				true,
431
-				Html::element( 'br' )
431
+				Html::element('br')
432 432
 			);
433 433
 			$referenceStatus = $this->msg(
434
-				'wbqev-crosscheck-status-' . $result->getReferenceResult()->getStatus()
434
+				'wbqev-crosscheck-status-'.$result->getReferenceResult()->getStatus()
435 435
 			)->text();
436
-			$dataSource = $this->entityIdLinkFormatter->formatEntityId( $result->getDumpMetaInformation()->getSourceItemId() );
436
+			$dataSource = $this->entityIdLinkFormatter->formatEntityId($result->getDumpMetaInformation()->getSourceItemId());
437 437
 
438 438
 			$table->appendRow(
439 439
 				[
440
-					new HtmlTableCellBuilder( $status, [], true ),
441
-					new HtmlTableCellBuilder( $propertyId, [], true ),
442
-					new HtmlTableCellBuilder( $localValue, [], true ),
443
-					new HtmlTableCellBuilder( $externalValue, [], true ),
444
-					new HtmlTableCellBuilder( $referenceStatus, [] ),
445
-					new HtmlTableCellBuilder( $dataSource, [], true )
440
+					new HtmlTableCellBuilder($status, [], true),
441
+					new HtmlTableCellBuilder($propertyId, [], true),
442
+					new HtmlTableCellBuilder($localValue, [], true),
443
+					new HtmlTableCellBuilder($externalValue, [], true),
444
+					new HtmlTableCellBuilder($referenceStatus, []),
445
+					new HtmlTableCellBuilder($dataSource, [], true)
446 446
 				]
447 447
 			);
448 448
 		}
Please login to merge, or discard this patch.
includes/DumpMetaInformation/DumpMetaInformationLookup.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @return DumpMetaInformation[]
21 21
 	 * @throws \InvalidArgumentException
22 22
 	 */
23
-	public function getWithIds( array $dumpIds );
23
+	public function getWithIds(array $dumpIds);
24 24
 
25 25
 	/**
26 26
 	 * Gets DumpMetaInformation for specific identifier properties from database
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @return DumpMetaInformation[]
32 32
 	 */
33
-	public function getWithIdentifierProperties( array $identifierPropertyIds );
33
+	public function getWithIdentifierProperties(array $identifierPropertyIds);
34 34
 
35 35
 	/**
36 36
 	 * Gets all DumpMetaInformation from database
Please login to merge, or discard this patch.
maintenance/UpdateExternalData.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
 use WikibaseQuality\ExternalValidation\UpdateExternalData\CsvImportSettings;
8 8
 use WikibaseQuality\ExternalValidation\UpdateExternalData\ExternalDataImporter;
9 9
 
10
-$basePath = getenv( 'MW_INSTALL_PATH' ) !== false
11
-	? getenv( 'MW_INSTALL_PATH' )
12
-	: __DIR__ . '/../../..';
13
-require_once $basePath . '/maintenance/Maintenance.php';
10
+$basePath = getenv('MW_INSTALL_PATH') !== false
11
+	? getenv('MW_INSTALL_PATH')
12
+	: __DIR__.'/../../..';
13
+require_once $basePath.'/maintenance/Maintenance.php';
14 14
 
15 15
 /**
16 16
  * Maintenance script that evokes updates of wbqev_external_data, wbqev_dump_information, wbqev_identifier_properties
@@ -25,17 +25,17 @@  discard block
 block discarded – undo
25 25
 	public function __construct() {
26 26
 		parent::__construct();
27 27
 
28
-		$this->addDescription( 'Imports external entities from given CSV files into the local '
29
-			. 'database. CSV files can be generated using the DumpConverter.' );
30
-		$this->addOption( 'external-values-file', 'CSV file containing external values for import.', true, true );
31
-		$this->addOption( 'dump-information-file', 'CSV file containing dump meta information for import.', true, true );
32
-		$this->setBatchSize( 1000 );
28
+		$this->addDescription('Imports external entities from given CSV files into the local '
29
+			. 'database. CSV files can be generated using the DumpConverter.');
30
+		$this->addOption('external-values-file', 'CSV file containing external values for import.', true, true);
31
+		$this->addOption('dump-information-file', 'CSV file containing dump meta information for import.', true, true);
32
+		$this->setBatchSize(1000);
33 33
 	}
34 34
 
35 35
 	public function execute() {
36 36
 		$context = new CsvImportSettings(
37
-			$this->getOption( 'external-values-file' ),
38
-			$this->getOption( 'dump-information-file' ),
37
+			$this->getOption('external-values-file'),
38
+			$this->getOption('dump-information-file'),
39 39
 			$this->mBatchSize,
40 40
 			$this->isQuiet()
41 41
 		);
Please login to merge, or discard this patch.