Completed
Push — master ( 534711...a187dc )
by
unknown
07:29
created
includes/CrossCheck/Result/CrossCheckResult.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -73,8 +73,8 @@
 block discarded – undo
73 73
 		ComparisonResult $comparisonResult,
74 74
 		ReferenceResult $referenceResult
75 75
 	) {
76
-		Assert::parameterType( 'string', $claimGuid, '$claimGuid' );
77
-		Assert::parameterType( 'string', $externalId, '$externalId' );
76
+		Assert::parameterType('string', $claimGuid, '$claimGuid');
77
+		Assert::parameterType('string', $externalId, '$externalId');
78 78
 
79 79
 		$this->propertyId = $propertyId;
80 80
 		$this->claimGuid = $claimGuid;
Please login to merge, or discard this patch.
includes/ExternalValidationServices.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 *
73 73
 	 * @fixme inject specific things needed here instead of the WikibaseRepo factory. (T112105)
74 74
 	 */
75
-	public function __construct( WikibaseRepo $wikibaseRepo ) {
75
+	public function __construct(WikibaseRepo $wikibaseRepo) {
76 76
 		$this->wikibaseRepo = $wikibaseRepo;
77 77
 	}
78 78
 
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
 	public static function getDefaultInstance() {
86 86
 		static $instance = null;
87 87
 
88
-		if ( $instance === null ) {
88
+		if ($instance === null) {
89 89
 			$wikibaseRepo = WikibaseRepo::getDefaultInstance();
90 90
 
91
-			$instance = new self( $wikibaseRepo );
91
+			$instance = new self($wikibaseRepo);
92 92
 		}
93 93
 
94 94
 		return $instance;
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @return CrossChecker
99 99
 	 */
100 100
 	public function getCrossChecker() {
101
-		if ( $this->crossChecker === null ) {
101
+		if ($this->crossChecker === null) {
102 102
 			$this->crossChecker = new CrossChecker(
103 103
 				$this->wikibaseRepo->getEntityLookup(),
104 104
 				$this->getComparativeValueParserFactory(),
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 * @return CrossCheckInteractor
117 117
 	 */
118 118
 	public function getCrossCheckInteractor() {
119
-		if ( $this->crossCheckInteractor === null ) {
119
+		if ($this->crossCheckInteractor === null) {
120 120
 			$this->crossCheckInteractor = new CrossCheckInteractor(
121 121
 				$this->wikibaseRepo->getEntityLookup(),
122 122
 				$this->wikibaseRepo->getStatementGuidParser(),
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @return ComparativeValueParserFactory
132 132
 	 */
133 133
 	public function getComparativeValueParserFactory() {
134
-		if ( $this->comparativeValueParserFactory === null ) {
134
+		if ($this->comparativeValueParserFactory === null) {
135 135
 			$this->comparativeValueParserFactory = new ComparativeValueParserFactory(
136 136
 				$this->wikibaseRepo->getDataTypeDefinitions(),
137 137
 				new StringNormalizer()
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @return DataValueComparerFactory
146 146
 	 */
147 147
 	public function getDataValueComparerFactory() {
148
-		if ( $this->dataValueComparerFactory === null ) {
148
+		if ($this->dataValueComparerFactory === null) {
149 149
 			$this->dataValueComparerFactory = new DataValueComparerFactory(
150 150
 				$this->wikibaseRepo->getStore()->getTermIndex(),
151 151
 				$this->wikibaseRepo->getStringNormalizer()
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * @return DumpMetaInformationLookup
160 160
 	 */
161 161
 	public function getDumpMetaInformationLookup() {
162
-		if ( $this->dumpMetaInformationLookup === null ) {
162
+		if ($this->dumpMetaInformationLookup === null) {
163 163
 			$this->dumpMetaInformationLookup = new SqlDumpMetaInformationRepo();
164 164
 		}
165 165
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @return DumpMetaInformationStore
171 171
 	 */
172 172
 	public function getDumpMetaInformationStore() {
173
-		if ( $this->dumpMetaInformationStore === null ) {
173
+		if ($this->dumpMetaInformationStore === null) {
174 174
 			$this->dumpMetaInformationStore = new SqlDumpMetaInformationRepo();
175 175
 		}
176 176
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @return ExternalDataRepo
182 182
 	 */
183 183
 	public function getExternalDataRepo() {
184
-		if ( $this->externalDataRepo === null ) {
184
+		if ($this->externalDataRepo === null) {
185 185
 			$this->externalDataRepo = new ExternalDataRepo();
186 186
 		}
187 187
 
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 	 * @return SerializerFactory
193 193
 	 */
194 194
 	public function getSerializerFactory() {
195
-		if ( $this->serializerFactory === null ) {
195
+		if ($this->serializerFactory === null) {
196 196
 			$dataValueSerializer = new DataValueSerializer();
197
-			$dataModelSerializerFactory = new \Wikibase\DataModel\SerializerFactory( $dataValueSerializer );
197
+			$dataModelSerializerFactory = new \Wikibase\DataModel\SerializerFactory($dataValueSerializer);
198 198
 			$this->serializerFactory = new SerializerFactory(
199 199
 				$dataValueSerializer,
200 200
 				$dataModelSerializerFactory->newReferenceSerializer()
Please login to merge, or discard this patch.
api/RunCrossCheck.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @return self
67 67
 	 */
68
-	public static function newFromGlobalState( ApiMain $main, $name, $prefix = '' ) {
68
+	public static function newFromGlobalState(ApiMain $main, $name, $prefix = '') {
69 69
 		$repo = WikibaseRepo::getDefaultInstance();
70 70
 		$externalValidationServices = ExternalValidationServices::getDefaultInstance();
71 71
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 			$repo->getStatementGuidValidator(),
78 78
 			$externalValidationServices->getCrossCheckInteractor(),
79 79
 			$externalValidationServices->getSerializerFactory(),
80
-			$repo->getApiHelperFactory( RequestContext::getMain() )
80
+			$repo->getApiHelperFactory(RequestContext::getMain())
81 81
 		);
82 82
 	}
83 83
 
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
 		SerializerFactory $serializerFactory,
102 102
 		ApiHelperFactory $apiHelperFactory
103 103
 	) {
104
-		parent::__construct( $main, $name, $prefix );
104
+		parent::__construct($main, $name, $prefix);
105 105
 
106 106
 		$this->entityIdParser = $entityIdParser;
107 107
 		$this->statementGuidValidator = $statementGuidValidator;
108 108
 		$this->crossCheckInteractor = $crossCheckInteractor;
109 109
 		$this->serializerFactory = $serializerFactory;
110
-		$this->resultBuilder = $apiHelperFactory->getResultBuilder( $this );
111
-		$this->errorReporter = $apiHelperFactory->getErrorReporter( $this );
110
+		$this->resultBuilder = $apiHelperFactory->getResultBuilder($this);
111
+		$this->errorReporter = $apiHelperFactory->getErrorReporter($this);
112 112
 	}
113 113
 
114 114
 	/**
@@ -117,34 +117,34 @@  discard block
 block discarded – undo
117 117
 	public function execute() {
118 118
 		$params = $this->extractRequestParams();
119 119
 
120
-		if ( $params['entities'] && $params['claims'] ) {
120
+		if ($params['entities'] && $params['claims']) {
121 121
 			$this->errorReporter->dieError(
122 122
 				'Either provide the ids of entities or ids of claims, that should be cross-checked.',
123 123
 				'param-invalid'
124 124
 			);
125 125
 			throw new LogicException();
126
-		} elseif ( $params['entities'] ) {
127
-			$entityIds = $this->parseEntityIds( $params['entities'] );
128
-			if ( $params['properties'] ) {
129
-				$propertyIds = $this->parseEntityIds( $params['properties'] );
130
-				$resultLists = $this->crossCheckInteractor->crossCheckEntitiesByIdWithProperties( $entityIds, $propertyIds );
126
+		} elseif ($params['entities']) {
127
+			$entityIds = $this->parseEntityIds($params['entities']);
128
+			if ($params['properties']) {
129
+				$propertyIds = $this->parseEntityIds($params['properties']);
130
+				$resultLists = $this->crossCheckInteractor->crossCheckEntitiesByIdWithProperties($entityIds, $propertyIds);
131 131
 			} else {
132
-				$resultLists = $this->crossCheckInteractor->crossCheckEntitiesByIds( $entityIds );
132
+				$resultLists = $this->crossCheckInteractor->crossCheckEntitiesByIds($entityIds);
133 133
 			}
134
-		} elseif ( $params['claims'] ) {
134
+		} elseif ($params['claims']) {
135 135
 			$guids = $params['claims'];
136
-			$this->assertAreValidClaimGuids( $guids );
137
-			$resultLists = $this->crossCheckInteractor->crossCheckStatementsByGuids( $guids );
136
+			$this->assertAreValidClaimGuids($guids);
137
+			$resultLists = $this->crossCheckInteractor->crossCheckStatementsByGuids($guids);
138 138
 		} else {
139 139
 			$this->errorReporter->dieWithError(
140
-				[ 'wikibase-api-param-missing', 'entities|claims' ],
140
+				['wikibase-api-param-missing', 'entities|claims'],
141 141
 				'param-missing'
142 142
 			);
143 143
 			throw new LogicException();
144 144
 		}
145 145
 
146 146
 		// Print result lists
147
-		$this->writeResultOutput( $resultLists );
147
+		$this->writeResultOutput($resultLists);
148 148
 	}
149 149
 
150 150
 	/**
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 	 *
153 153
 	 * @return EntityId[]
154 154
 	 */
155
-	private function parseEntityIds( array $entityIds ) {
155
+	private function parseEntityIds(array $entityIds) {
156 156
 		return array_map(
157
-			[ $this->entityIdParser, 'parse' ],
157
+			[$this->entityIdParser, 'parse'],
158 158
 			$entityIds
159 159
 		);
160 160
 	}
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 	/**
163 163
 	 * @param string[] $guids
164 164
 	 */
165
-	private function assertAreValidClaimGuids( array $guids ) {
166
-		foreach ( $guids as $guid ) {
167
-			if ( $this->statementGuidValidator->validateFormat( $guid ) === false ) {
168
-				$this->errorReporter->dieError( 'Invalid claim guid.', 'invalid-guid' );
165
+	private function assertAreValidClaimGuids(array $guids) {
166
+		foreach ($guids as $guid) {
167
+			if ($this->statementGuidValidator->validateFormat($guid) === false) {
168
+				$this->errorReporter->dieError('Invalid claim guid.', 'invalid-guid');
169 169
 			}
170 170
 		}
171 171
 	}
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
 	 *
178 178
 	 * @return array
179 179
 	 */
180
-	private function writeResultOutput( array $resultLists ) {
180
+	private function writeResultOutput(array $resultLists) {
181 181
 		$serializer = $this->serializerFactory->newCrossCheckResultListSerializer();
182 182
 
183 183
 		$output = [];
184
-		foreach ( $resultLists as $entityId => $resultList ) {
185
-			if ( $resultList ) {
186
-				$serializedResultList = $serializer->serialize( $resultList );
184
+		foreach ($resultLists as $entityId => $resultList) {
185
+			if ($resultList) {
186
+				$serializedResultList = $serializer->serialize($resultList);
187 187
 
188 188
 				$output[$entityId] = $serializedResultList;
189 189
 			} else {
@@ -193,10 +193,10 @@  discard block
 block discarded – undo
193 193
 			}
194 194
 		}
195 195
 
196
-		$this->getResult()->setIndexedTagName( $output, 'entity' );
197
-		$this->getResult()->setArrayType( $output, 'kvp', 'id' );
198
-		$this->getResult()->addValue( null, 'results', $output );
199
-		$this->resultBuilder->markSuccess( 1 );
196
+		$this->getResult()->setIndexedTagName($output, 'entity');
197
+		$this->getResult()->setArrayType($output, 'kvp', 'id');
198
+		$this->getResult()->addValue(null, 'results', $output);
199
+		$this->resultBuilder->markSuccess(1);
200 200
 	}
201 201
 
202 202
 	/**
Please login to merge, or discard this patch.
WikibaseQualityExternalValidation.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
4
-	require_once __DIR__ . '/vendor/autoload.php';
3
+if (is_readable(__DIR__.'/vendor/autoload.php')) {
4
+	require_once __DIR__.'/vendor/autoload.php';
5 5
 }
6 6
 
7
-call_user_func( function () {
7
+call_user_func(function() {
8 8
 	// Set credits
9 9
 	$GLOBALS['wgExtensionCredits']['wikibase'][] = [
10 10
 		'path' => __FILE__,
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 	];
18 18
 
19 19
 	// Initialize localization and aliases
20
-	$GLOBALS['wgMessagesDirs']['WikibaseQualityExternalValidation'] = __DIR__ . '/i18n';
20
+	$GLOBALS['wgMessagesDirs']['WikibaseQualityExternalValidation'] = __DIR__.'/i18n';
21 21
 	$GLOBALS['wgExtensionMessagesFiles']['WikibaseQualityExternalValidationAlias'] =
22
-		__DIR__ . '/WikibaseQualityExternalValidation.alias.php';
22
+		__DIR__.'/WikibaseQualityExternalValidation.alias.php';
23 23
 
24 24
 	// Initalize hooks for creating database tables
25 25
 	$GLOBALS['wgHooks']['LoadExtensionSchemaUpdates'][] =
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 	// Define API modules
39 39
 	$GLOBALS['wgAPIModules']['wbqevcrosscheck'] = [
40 40
 		'class' => WikibaseQuality\ExternalValidation\Api\RunCrossCheck::class,
41
-		'factory' => function( ApiMain $main, $action ) {
42
-			return WikibaseQuality\ExternalValidation\Api\RunCrossCheck::newFromGlobalState( $main, $action );
41
+		'factory' => function(ApiMain $main, $action) {
42
+			return WikibaseQuality\ExternalValidation\Api\RunCrossCheck::newFromGlobalState($main, $action);
43 43
 		}
44 44
 	];
45 45
 
Please login to merge, or discard this patch.