Completed
Push — master ( 400d3d...683449 )
by
unknown
02:21
created
includes/ExternalDataRepo.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -24,23 +24,23 @@  discard block
 block discarded – undo
24 24
 	 * @param PropertyId[] $propertyIds
25 25
 	 * @return array
26 26
 	 */
27
-	public function getExternalData( array $dumpIds, array $externalIds, array $propertyIds ) {
28
-		Assert::parameterElementType( 'string', $dumpIds, '$dumpIds' );
29
-		Assert::parameterElementType( 'string', $externalIds, '$externalIds' );
30
-		Assert::parameterElementType( PropertyId::class, $propertyIds, '$propertyIds' );
31
-		Assert::parameter( count( $dumpIds ) > 0, '$dumpIds', '$dumpIds has to contain at least one element.' );
32
-		Assert::parameter( count( $externalIds ) > 0, '$externalIds', '$externalIds has to contain at least one element.' );
27
+	public function getExternalData(array $dumpIds, array $externalIds, array $propertyIds) {
28
+		Assert::parameterElementType('string', $dumpIds, '$dumpIds');
29
+		Assert::parameterElementType('string', $externalIds, '$externalIds');
30
+		Assert::parameterElementType(PropertyId::class, $propertyIds, '$propertyIds');
31
+		Assert::parameter(count($dumpIds) > 0, '$dumpIds', '$dumpIds has to contain at least one element.');
32
+		Assert::parameter(count($externalIds) > 0, '$externalIds', '$externalIds has to contain at least one element.');
33 33
 
34 34
 		$conditions = [
35 35
 			'dump_id' => $dumpIds,
36 36
 			'external_id' => $externalIds
37 37
 		];
38
-		if ( $propertyIds ) {
38
+		if ($propertyIds) {
39 39
 			$conditions['pid'] = $propertyIds;
40 40
 		}
41 41
 
42 42
 		$externalData = [];
43
-		$db = wfGetDB( DB_REPLICA );
43
+		$db = wfGetDB(DB_REPLICA);
44 44
 		$result = $db->select(
45 45
 			self::TABLE_NAME,
46 46
 			[
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			$conditions
53 53
 		);
54 54
 
55
-		foreach ( $result as $row ) {
55
+		foreach ($result as $row) {
56 56
 			$externalData[$row->dump_id][$row->external_id][$row->pid][] = $row->external_value;
57 57
 		}
58 58
 
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
 	 * @param string $externalValue
69 69
 	 * @return bool
70 70
 	 */
71
-	public function insert( $dumpId, $externalId, PropertyId $propertyId, $externalValue ) {
72
-		Assert::parameterType( 'string', $dumpId, '$dumpId' );
73
-		Assert::parameterType( 'string', $externalId, '$externalId' );
74
-		Assert::parameterType( 'string', $externalValue, '$externalValue' );
71
+	public function insert($dumpId, $externalId, PropertyId $propertyId, $externalValue) {
72
+		Assert::parameterType('string', $dumpId, '$dumpId');
73
+		Assert::parameterType('string', $externalId, '$externalId');
74
+		Assert::parameterType('string', $externalValue, '$externalValue');
75 75
 
76
-		$externalDataBatch = [ func_get_args() ];
77
-		return $this->insertBatch( $externalDataBatch );
76
+		$externalDataBatch = [func_get_args()];
77
+		return $this->insertBatch($externalDataBatch);
78 78
 	}
79 79
 
80 80
 	/**
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 	 * @throws DBError
85 85
 	 * @return bool
86 86
 	 */
87
-	public function insertBatch( array $externalDataBatch ) {
88
-		$db = wfGetDB( DB_MASTER );
87
+	public function insertBatch(array $externalDataBatch) {
88
+		$db = wfGetDB(DB_MASTER);
89 89
 		$accumulator = array_map(
90
-			function ( $externalData ) use ( $db ) {
90
+			function($externalData) use ($db) {
91 91
 				return [
92 92
 					'dump_id' => $externalData[0],
93 93
 					'external_id' => $externalData[1],
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 
101 101
 		try {
102 102
 			$db->begin();
103
-			$result = $db->insert( self::TABLE_NAME, $accumulator );
103
+			$result = $db->insert(self::TABLE_NAME, $accumulator);
104 104
 			$db->commit();
105
-		} catch ( DBError $ex ) {
105
+		} catch (DBError $ex) {
106 106
 			$db->rollback();
107 107
 			throw $ex;
108 108
 		}
@@ -117,22 +117,22 @@  discard block
 block discarded – undo
117 117
 	 * @param int $batchSize
118 118
 	 * @throws \Wikimedia\Rdbms\DBUnexpectedError
119 119
 	 */
120
-	public function deleteOfDump( $dumpId, $batchSize = 1000 ) {
121
-		Assert::parameterType( 'string', $dumpId, '$dumpId' );
122
-		Assert::parameterType( 'integer', $batchSize, 'batchSize' );
120
+	public function deleteOfDump($dumpId, $batchSize = 1000) {
121
+		Assert::parameterType('string', $dumpId, '$dumpId');
122
+		Assert::parameterType('integer', $batchSize, 'batchSize');
123 123
 
124 124
 		$lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
125
-		$db = $lbFactory->getMainLB()->getConnection( DB_MASTER );
126
-		if ( $db->getType() === 'sqlite' ) {
127
-			$db->delete( self::TABLE_NAME, [ 'dump_id' => $dumpId ] );
125
+		$db = $lbFactory->getMainLB()->getConnection(DB_MASTER);
126
+		if ($db->getType() === 'sqlite') {
127
+			$db->delete(self::TABLE_NAME, ['dump_id' => $dumpId]);
128 128
 		} else {
129 129
 			do {
130
-				$db->commit( __METHOD__, 'flush' );
130
+				$db->commit(__METHOD__, 'flush');
131 131
 				$lbFactory->waitForReplication();
132
-				$table = $db->tableName( self::TABLE_NAME );
133
-				$condition = 'dump_id = ' . $db->addQuotes( $dumpId );
134
-				$db->query( sprintf( 'DELETE FROM %s WHERE %s LIMIT %d', $table, $condition, $batchSize ) );
135
-			} while ( $db->affectedRows() > 0 );
132
+				$table = $db->tableName(self::TABLE_NAME);
133
+				$condition = 'dump_id = '.$db->addQuotes($dumpId);
134
+				$db->query(sprintf('DELETE FROM %s WHERE %s LIMIT %d', $table, $condition, $batchSize));
135
+			} while ($db->affectedRows() > 0);
136 136
 		}
137 137
 	}
138 138
 
Please login to merge, or discard this patch.
includes/UpdateExternalData/ExternalDataImporter.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 	public function import() {
48 48
 		$dumpIds = $this->insertMetaInformation();
49 49
 
50
-		$this->log( "\nDelete old database entries...\n" );
50
+		$this->log("\nDelete old database entries...\n");
51 51
 
52
-		foreach ( $dumpIds as $dumpId ) {
53
-			$this->externalDataRepo->deleteOfDump( $dumpId, $this->importSettings->getBatchSize() );
52
+		foreach ($dumpIds as $dumpId) {
53
+			$this->externalDataRepo->deleteOfDump($dumpId, $this->importSettings->getBatchSize());
54 54
 		}
55 55
 
56
-		$this->log( "\n" );
56
+		$this->log("\n");
57 57
 
58 58
 		$this->insertExternalValues();
59 59
 	}
@@ -64,52 +64,52 @@  discard block
 block discarded – undo
64 64
 	 * @return array
65 65
 	 */
66 66
 	protected function insertMetaInformation() {
67
-		$this->log( "Insert new dump meta information\n" );
67
+		$this->log("Insert new dump meta information\n");
68 68
 
69
-		$csvFile = fopen( $this->importSettings->getDumpInformationFilePath(), 'rb' );
70
-		if ( !$csvFile ) {
71
-			exit( 'Error while reading CSV file.' );
69
+		$csvFile = fopen($this->importSettings->getDumpInformationFilePath(), 'rb');
70
+		if (!$csvFile) {
71
+			exit('Error while reading CSV file.');
72 72
 		}
73 73
 
74 74
 		$i = 0;
75 75
 		$dumpIds = [];
76
-		while ( $data = fgetcsv( $csvFile ) ) {
76
+		while ($data = fgetcsv($csvFile)) {
77 77
 			$identifierPropertyIds = array_map(
78
-				function ( $propertyId ) {
79
-					return new PropertyId( $propertyId );
78
+				function($propertyId) {
79
+					return new PropertyId($propertyId);
80 80
 				},
81
-				json_decode( $data[2] )
81
+				json_decode($data[2])
82 82
 			);
83 83
 			try {
84 84
 				$dumpMetaInformation = new DumpMetaInformation(
85 85
 					$data[0],
86
-					new ItemId( $data[1] ),
86
+					new ItemId($data[1]),
87 87
 					$identifierPropertyIds,
88 88
 					$data[3],
89 89
 					$data[4],
90 90
 					$data[5],
91
-					intval( $data[6] ),
92
-					new ItemId( $data[7] )
91
+					intval($data[6]),
92
+					new ItemId($data[7])
93 93
 				);
94
-			} catch ( \InvalidArgumentException $e ) {
95
-				exit( 'Input file has bad formatted values.' );
94
+			} catch (\InvalidArgumentException $e) {
95
+				exit('Input file has bad formatted values.');
96 96
 			}
97 97
 			$dumpIds[] = $dumpMetaInformation->getDumpId();
98 98
 
99 99
 			try {
100
-				$this->dumpMetaInformationStore->save( $dumpMetaInformation );
101
-			} catch ( DBError $e ) {
102
-				exit( 'Unknown database error occurred.' );
100
+				$this->dumpMetaInformationStore->save($dumpMetaInformation);
101
+			} catch (DBError $e) {
102
+				exit('Unknown database error occurred.');
103 103
 			}
104 104
 
105 105
 			$i++;
106
-			$this->log( "\r\033[K" );
107
-			$this->log( "$i rows inserted or updated" );
106
+			$this->log("\r\033[K");
107
+			$this->log("$i rows inserted or updated");
108 108
 		}
109 109
 
110
-		fclose( $csvFile );
110
+		fclose($csvFile);
111 111
 
112
-		$this->log( "\n" );
112
+		$this->log("\n");
113 113
 
114 114
 		return $dumpIds;
115 115
 	}
@@ -118,32 +118,32 @@  discard block
 block discarded – undo
118 118
 	 * Inserts external values stored in csv file into database
119 119
 	 */
120 120
 	private function insertExternalValues() {
121
-		$this->log( "Insert new data values\n" );
121
+		$this->log("Insert new data values\n");
122 122
 
123
-		$csvFile = fopen( $this->importSettings->getExternalValuesFilePath(), 'rb' );
124
-		if ( !$csvFile ) {
125
-			exit( 'Error while reading CSV file.' );
123
+		$csvFile = fopen($this->importSettings->getExternalValuesFilePath(), 'rb');
124
+		if (!$csvFile) {
125
+			exit('Error while reading CSV file.');
126 126
 		}
127 127
 
128 128
 		$i = 0;
129 129
 		$accumulator = [];
130 130
 		$lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
131
-		while ( true ) {
132
-			$data = fgetcsv( $csvFile );
133
-			if ( $data === false || ++$i % $this->importSettings->getBatchSize() === 0 ) {
131
+		while (true) {
132
+			$data = fgetcsv($csvFile);
133
+			if ($data === false || ++$i % $this->importSettings->getBatchSize() === 0) {
134 134
 				try {
135
-					$this->externalDataRepo->insertBatch( $accumulator );
136
-				} catch ( DBError $e ) {
137
-					exit( 'Unknown database error occurred.' );
135
+					$this->externalDataRepo->insertBatch($accumulator);
136
+				} catch (DBError $e) {
137
+					exit('Unknown database error occurred.');
138 138
 				}
139 139
 				$lbFactory->waitForReplication();
140 140
 
141
-				$this->log( "\r\033[K" );
142
-				$this->log( "$i rows inserted" );
141
+				$this->log("\r\033[K");
142
+				$this->log("$i rows inserted");
143 143
 
144 144
 				$accumulator = [];
145 145
 
146
-				if ( $data === false ) {
146
+				if ($data === false) {
147 147
 					break;
148 148
 				}
149 149
 			}
@@ -151,16 +151,16 @@  discard block
 block discarded – undo
151 151
 			$accumulator[] = $data;
152 152
 		}
153 153
 
154
-		fclose( $csvFile );
154
+		fclose($csvFile);
155 155
 
156
-		$this->log( "\n" );
156
+		$this->log("\n");
157 157
 	}
158 158
 
159 159
 	/**
160 160
 	 * @param string $text
161 161
 	 */
162
-	private function log( $text ) {
163
-		if ( !$this->importSettings->isQuiet() ) {
162
+	private function log($text) {
163
+		if (!$this->importSettings->isQuiet()) {
164 164
 			print $text;
165 165
 		}
166 166
 	}
Please login to merge, or discard this patch.
includes/CrossCheck/Comparer/StringComparer.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	private $stringNormalizer;
24 24
 
25
-	public function __construct( StringNormalizer $stringNormalizer ) {
25
+	public function __construct(StringNormalizer $stringNormalizer) {
26 26
 		$this->stringNormalizer = $stringNormalizer;
27 27
 	}
28 28
 
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 	 * @param string $comparativeValue
34 34
 	 * @return string
35 35
 	 */
36
-	public function compare( $value, $comparativeValue ) {
37
-		Assert::parameterType( 'string', $value, '$value' );
38
-		Assert::parameterType( 'string', $comparativeValue, '$comparativeValue' );
36
+	public function compare($value, $comparativeValue) {
37
+		Assert::parameterType('string', $value, '$value');
38
+		Assert::parameterType('string', $comparativeValue, '$comparativeValue');
39 39
 
40
-		$value = $this->cleanDataString( $value );
41
-		$comparativeValue = $this->cleanDataString( $comparativeValue );
40
+		$value = $this->cleanDataString($value);
41
+		$comparativeValue = $this->cleanDataString($comparativeValue);
42 42
 
43
-		if ( $value === $comparativeValue ) {
43
+		if ($value === $comparativeValue) {
44 44
 			return ComparisonResult::STATUS_MATCH;
45
-		} elseif ( $this->checkSimilarity( $value, $comparativeValue ) ) {
45
+		} elseif ($this->checkSimilarity($value, $comparativeValue)) {
46 46
 			return ComparisonResult::STATUS_PARTIAL_MATCH;
47 47
 		} else {
48 48
 			return ComparisonResult::STATUS_MISMATCH;
@@ -56,19 +56,19 @@  discard block
 block discarded – undo
56 56
 	 * @param array $comparativeValues
57 57
 	 * @return string
58 58
 	 */
59
-	public function compareWithArray( $value, array $comparativeValues ) {
60
-		Assert::parameterType( 'string', $value, '$value' );
61
-		Assert::parameterElementType( 'string', $comparativeValues, '$comparativeValues' );
59
+	public function compareWithArray($value, array $comparativeValues) {
60
+		Assert::parameterType('string', $value, '$value');
61
+		Assert::parameterElementType('string', $comparativeValues, '$comparativeValues');
62 62
 
63
-		$value = $this->cleanDataString( $value );
64
-		$comparativeValues = $this->cleanDataArray( $comparativeValues );
63
+		$value = $this->cleanDataString($value);
64
+		$comparativeValues = $this->cleanDataArray($comparativeValues);
65 65
 
66
-		if ( in_array( $value, $comparativeValues ) ) {
66
+		if (in_array($value, $comparativeValues)) {
67 67
 			return ComparisonResult::STATUS_MATCH;
68 68
 		}
69 69
 
70
-		foreach ( $comparativeValues as $comparativeValue ) {
71
-			if ( $this->checkSimilarity( $comparativeValue, $value ) ) {
70
+		foreach ($comparativeValues as $comparativeValue) {
71
+			if ($this->checkSimilarity($comparativeValue, $value)) {
72 72
 				return ComparisonResult::STATUS_PARTIAL_MATCH;
73 73
 			}
74 74
 		}
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 	 * @param string $comparativeValue
84 84
 	 * @return bool
85 85
 	 */
86
-	private function checkSimilarity( $value, $comparativeValue ) {
87
-		return $this->percentagePrefixSimilarity( $value, $comparativeValue ) > self::SIMILARITY_THRESHOLD
88
-			|| $this->percentageSuffixSimilarity( $value, $comparativeValue ) > self::SIMILARITY_THRESHOLD
89
-			|| $this->percentageLevenshteinDistance( $value, $comparativeValue ) > self::SIMILARITY_THRESHOLD;
86
+	private function checkSimilarity($value, $comparativeValue) {
87
+		return $this->percentagePrefixSimilarity($value, $comparativeValue) > self::SIMILARITY_THRESHOLD
88
+			|| $this->percentageSuffixSimilarity($value, $comparativeValue) > self::SIMILARITY_THRESHOLD
89
+			|| $this->percentageLevenshteinDistance($value, $comparativeValue) > self::SIMILARITY_THRESHOLD;
90 90
 	}
91 91
 
92 92
 	/**
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * @return string
98 98
 	 */
99
-	private function cleanDataString( $value ) {
100
-		$value = $this->stringNormalizer->trimToNFC( $value );
99
+	private function cleanDataString($value) {
100
+		$value = $this->stringNormalizer->trimToNFC($value);
101 101
 
102
-		return mb_strtolower( $value );
102
+		return mb_strtolower($value);
103 103
 	}
104 104
 
105 105
 	/**
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return array
111 111
 	 */
112
-	private function cleanDataArray( array $array ) {
112
+	private function cleanDataArray(array $array) {
113 113
 
114 114
 		return array_map(
115
-			[ $this, 'cleanDataString' ],
115
+			[$this, 'cleanDataString'],
116 116
 			$array );
117 117
 	}
118 118
 
@@ -124,19 +124,19 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @return float
126 126
 	 */
127
-	private function percentagePrefixSimilarity( $value, $comparativeValue ) {
127
+	private function percentagePrefixSimilarity($value, $comparativeValue) {
128 128
 		$prefixLength = 0; // common prefix length
129
-		$localLength = strlen( $value );
130
-		$externalLength = strlen( $comparativeValue );
131
-		while ( $prefixLength < min( $localLength, $externalLength ) ) {
129
+		$localLength = strlen($value);
130
+		$externalLength = strlen($comparativeValue);
131
+		while ($prefixLength < min($localLength, $externalLength)) {
132 132
 			$c = $value[$prefixLength];
133
-			if ( $externalLength > $prefixLength && $comparativeValue[$prefixLength] !== $c ) {
133
+			if ($externalLength > $prefixLength && $comparativeValue[$prefixLength] !== $c) {
134 134
 				break;
135 135
 			}
136 136
 			$prefixLength++;
137 137
 		}
138 138
 
139
-		return $prefixLength / max( $localLength, $externalLength );
139
+		return $prefixLength / max($localLength, $externalLength);
140 140
 	}
141 141
 
142 142
 	/**
@@ -147,19 +147,19 @@  discard block
 block discarded – undo
147 147
 	 *
148 148
 	 * @return float
149 149
 	 */
150
-	private function percentageSuffixSimilarity( $value, $comparativeValue ) {
150
+	private function percentageSuffixSimilarity($value, $comparativeValue) {
151 151
 		$suffixLength = 0; // common suffix length
152
-		$localLength = strlen( $value );
153
-		$externalLength = strlen( $comparativeValue );
154
-		while ( $suffixLength < min( $localLength, $externalLength ) ) {
152
+		$localLength = strlen($value);
153
+		$externalLength = strlen($comparativeValue);
154
+		while ($suffixLength < min($localLength, $externalLength)) {
155 155
 			$c = $value[$localLength - 1 - $suffixLength];
156
-			if ( $externalLength > $suffixLength && $comparativeValue[$externalLength - 1 - $suffixLength] !== $c ) {
156
+			if ($externalLength > $suffixLength && $comparativeValue[$externalLength - 1 - $suffixLength] !== $c) {
157 157
 				break;
158 158
 			}
159 159
 			$suffixLength++;
160 160
 		}
161 161
 
162
-		return $suffixLength / max( $localLength, $externalLength );
162
+		return $suffixLength / max($localLength, $externalLength);
163 163
 	}
164 164
 
165 165
 	/**
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 	 *
171 171
 	 * @return float
172 172
 	 */
173
-	private function percentageLevenshteinDistance( $value, $comparativeValue ) {
174
-		$distance = levenshtein( $value, $comparativeValue );
175
-		$percentage = 1.0 - $distance / max( strlen( $value ), strlen( $comparativeValue ) );
173
+	private function percentageLevenshteinDistance($value, $comparativeValue) {
174
+		$distance = levenshtein($value, $comparativeValue);
175
+		$percentage = 1.0 - $distance / max(strlen($value), strlen($comparativeValue));
176 176
 
177 177
 		return $percentage;
178 178
 	}
Please login to merge, or discard this patch.
api/RunCrossCheck.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@
 block discarded – undo
172 172
 	/**
173 173
 	 * Writes output for CrossCheckResultList
174 174
 	 *
175
-	 * @param array $resultLists
175
+	 * @param \WikibaseQuality\ExternalValidation\CrossCheck\Result\CrossCheckResultList[] $resultLists
176 176
 	 */
177 177
 	private function writeResultOutput( array $resultLists ) {
178 178
 		$serializer = $this->serializerFactory->newCrossCheckResultListSerializer();
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 * @return self
66 66
 	 */
67
-	public static function newFromGlobalState( ApiMain $main, $name, $prefix = '' ) {
67
+	public static function newFromGlobalState(ApiMain $main, $name, $prefix = '') {
68 68
 		$repo = WikibaseRepo::getDefaultInstance();
69 69
 		$externalValidationServices = ExternalValidationServices::getDefaultInstance();
70 70
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 			$repo->getStatementGuidValidator(),
77 77
 			$externalValidationServices->getCrossCheckInteractor(),
78 78
 			$externalValidationServices->getSerializerFactory(),
79
-			$repo->getApiHelperFactory( RequestContext::getMain() )
79
+			$repo->getApiHelperFactory(RequestContext::getMain())
80 80
 		);
81 81
 	}
82 82
 
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 		SerializerFactory $serializerFactory,
101 101
 		ApiHelperFactory $apiHelperFactory
102 102
 	) {
103
-		parent::__construct( $main, $name, $prefix );
103
+		parent::__construct($main, $name, $prefix);
104 104
 
105 105
 		$this->entityIdParser = $entityIdParser;
106 106
 		$this->statementGuidValidator = $statementGuidValidator;
107 107
 		$this->crossCheckInteractor = $crossCheckInteractor;
108 108
 		$this->serializerFactory = $serializerFactory;
109
-		$this->resultBuilder = $apiHelperFactory->getResultBuilder( $this );
110
-		$this->errorReporter = $apiHelperFactory->getErrorReporter( $this );
109
+		$this->resultBuilder = $apiHelperFactory->getResultBuilder($this);
110
+		$this->errorReporter = $apiHelperFactory->getErrorReporter($this);
111 111
 	}
112 112
 
113 113
 	/**
@@ -116,34 +116,34 @@  discard block
 block discarded – undo
116 116
 	public function execute() {
117 117
 		$params = $this->extractRequestParams();
118 118
 
119
-		if ( $params['entities'] && $params['claims'] ) {
119
+		if ($params['entities'] && $params['claims']) {
120 120
 			$this->errorReporter->dieError(
121 121
 				'Either provide the ids of entities or ids of claims, that should be cross-checked.',
122 122
 				'param-invalid'
123 123
 			);
124 124
 			throw new LogicException();
125
-		} elseif ( $params['entities'] ) {
126
-			$entityIds = $this->parseEntityIds( $params['entities'] );
127
-			if ( $params['properties'] ) {
128
-				$propertyIds = $this->parseEntityIds( $params['properties'] );
129
-				$resultLists = $this->crossCheckInteractor->crossCheckEntitiesByIdWithProperties( $entityIds, $propertyIds );
125
+		} elseif ($params['entities']) {
126
+			$entityIds = $this->parseEntityIds($params['entities']);
127
+			if ($params['properties']) {
128
+				$propertyIds = $this->parseEntityIds($params['properties']);
129
+				$resultLists = $this->crossCheckInteractor->crossCheckEntitiesByIdWithProperties($entityIds, $propertyIds);
130 130
 			} else {
131
-				$resultLists = $this->crossCheckInteractor->crossCheckEntitiesByIds( $entityIds );
131
+				$resultLists = $this->crossCheckInteractor->crossCheckEntitiesByIds($entityIds);
132 132
 			}
133
-		} elseif ( $params['claims'] ) {
133
+		} elseif ($params['claims']) {
134 134
 			$guids = $params['claims'];
135
-			$this->assertAreValidClaimGuids( $guids );
136
-			$resultLists = $this->crossCheckInteractor->crossCheckStatementsByGuids( $guids );
135
+			$this->assertAreValidClaimGuids($guids);
136
+			$resultLists = $this->crossCheckInteractor->crossCheckStatementsByGuids($guids);
137 137
 		} else {
138 138
 			$this->errorReporter->dieWithError(
139
-				[ 'wikibase-api-param-missing', 'entities|claims' ],
139
+				['wikibase-api-param-missing', 'entities|claims'],
140 140
 				'param-missing'
141 141
 			);
142 142
 			throw new LogicException();
143 143
 		}
144 144
 
145 145
 		// Print result lists
146
-		$this->writeResultOutput( $resultLists );
146
+		$this->writeResultOutput($resultLists);
147 147
 	}
148 148
 
149 149
 	/**
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	 *
152 152
 	 * @return EntityId[]
153 153
 	 */
154
-	private function parseEntityIds( array $entityIds ) {
154
+	private function parseEntityIds(array $entityIds) {
155 155
 		return array_map(
156
-			[ $this->entityIdParser, 'parse' ],
156
+			[$this->entityIdParser, 'parse'],
157 157
 			$entityIds
158 158
 		);
159 159
 	}
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 	/**
162 162
 	 * @param string[] $guids
163 163
 	 */
164
-	private function assertAreValidClaimGuids( array $guids ) {
165
-		foreach ( $guids as $guid ) {
166
-			if ( $this->statementGuidValidator->validateFormat( $guid ) === false ) {
167
-				$this->errorReporter->dieError( 'Invalid claim guid.', 'invalid-guid' );
164
+	private function assertAreValidClaimGuids(array $guids) {
165
+		foreach ($guids as $guid) {
166
+			if ($this->statementGuidValidator->validateFormat($guid) === false) {
167
+				$this->errorReporter->dieError('Invalid claim guid.', 'invalid-guid');
168 168
 			}
169 169
 		}
170 170
 	}
@@ -174,13 +174,13 @@  discard block
 block discarded – undo
174 174
 	 *
175 175
 	 * @param array $resultLists
176 176
 	 */
177
-	private function writeResultOutput( array $resultLists ) {
177
+	private function writeResultOutput(array $resultLists) {
178 178
 		$serializer = $this->serializerFactory->newCrossCheckResultListSerializer();
179 179
 
180 180
 		$output = [];
181
-		foreach ( $resultLists as $entityId => $resultList ) {
182
-			if ( $resultList ) {
183
-				$serializedResultList = $serializer->serialize( $resultList );
181
+		foreach ($resultLists as $entityId => $resultList) {
182
+			if ($resultList) {
183
+				$serializedResultList = $serializer->serialize($resultList);
184 184
 
185 185
 				$output[$entityId] = $serializedResultList;
186 186
 			} else {
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
 			}
191 191
 		}
192 192
 
193
-		$this->getResult()->setIndexedTagName( $output, 'entity' );
194
-		$this->getResult()->setArrayType( $output, 'kvp', 'id' );
195
-		$this->getResult()->addValue( null, 'results', $output );
196
-		$this->resultBuilder->markSuccess( 1 );
193
+		$this->getResult()->setIndexedTagName($output, 'entity');
194
+		$this->getResult()->setArrayType($output, 'kvp', 'id');
195
+		$this->getResult()->addValue(null, 'results', $output);
196
+		$this->resultBuilder->markSuccess(1);
197 197
 	}
198 198
 
199 199
 	/**
Please login to merge, or discard this patch.