@@ -1,10 +1,10 @@ discard block |
||
| 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,8 +17,8 @@ discard block |
||
| 17 | 17 | ]; |
| 18 | 18 | |
| 19 | 19 | // Initialize localization and aliases |
| 20 | - $GLOBALS['wgMessagesDirs']['WikibaseQualityExternalValidation'] = __DIR__ . '/i18n'; |
|
| 21 | - $GLOBALS['wgExtensionMessagesFiles']['WikibaseQualityExternalValidationAlias'] = __DIR__ . '/WikibaseQualityExternalValidation.alias.php'; |
|
| 20 | + $GLOBALS['wgMessagesDirs']['WikibaseQualityExternalValidation'] = __DIR__.'/i18n'; |
|
| 21 | + $GLOBALS['wgExtensionMessagesFiles']['WikibaseQualityExternalValidationAlias'] = __DIR__.'/WikibaseQualityExternalValidation.alias.php'; |
|
| 22 | 22 | |
| 23 | 23 | // Initalize hooks for creating database tables |
| 24 | 24 | $GLOBALS['wgHooks']['LoadExtensionSchemaUpdates'][] = |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | // Define API modules |
| 38 | 38 | $GLOBALS['wgAPIModules']['wbqevcrosscheck'] = [ |
| 39 | 39 | 'class' => WikibaseQuality\ExternalValidation\Api\RunCrossCheck::class, |
| 40 | - 'factory' => function( ApiMain $main, $action ) { |
|
| 41 | - return WikibaseQuality\ExternalValidation\Api\RunCrossCheck::newFromGlobalState( $main, $action ); |
|
| 40 | + 'factory' => function(ApiMain $main, $action) { |
|
| 41 | + return WikibaseQuality\ExternalValidation\Api\RunCrossCheck::newFromGlobalState($main, $action); |
|
| 42 | 42 | } |
| 43 | 43 | ]; |
| 44 | 44 | |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | '$identifierPropertyIds' |
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | - $this->setDumpId( $dumpId ); |
|
| 102 | + $this->setDumpId($dumpId); |
|
| 103 | 103 | $this->sourceItemId = $sourceItemId; |
| 104 | 104 | $this->identifierPropertyIds = $identifierPropertyIds; |
| 105 | - $this->setImportDate( $importDate ); |
|
| 106 | - $this->setLanguageCode( $languageCode ); |
|
| 107 | - $this->setSourceUrl( $sourceUrl ); |
|
| 108 | - $this->setSize( $size ); |
|
| 105 | + $this->setImportDate($importDate); |
|
| 106 | + $this->setLanguageCode($languageCode); |
|
| 107 | + $this->setSourceUrl($sourceUrl); |
|
| 108 | + $this->setSize($size); |
|
| 109 | 109 | $this->licenseItemId = $licenseItemId; |
| 110 | 110 | } |
| 111 | 111 | |
@@ -170,11 +170,11 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @throws InvalidArgumentException |
| 172 | 172 | */ |
| 173 | - private function setDumpId( $dumpId ) { |
|
| 174 | - Assert::parameterType( 'string', $dumpId, '$dumpId' ); |
|
| 175 | - $length = strlen( $dumpId ); |
|
| 176 | - if ( $length < 1 || $length > 25 ) { |
|
| 177 | - throw new InvalidArgumentException( '$dumpId must be between 1 and 25 characters.' ); |
|
| 173 | + private function setDumpId($dumpId) { |
|
| 174 | + Assert::parameterType('string', $dumpId, '$dumpId'); |
|
| 175 | + $length = strlen($dumpId); |
|
| 176 | + if ($length < 1 || $length > 25) { |
|
| 177 | + throw new InvalidArgumentException('$dumpId must be between 1 and 25 characters.'); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | $this->dumpId = $dumpId; |
@@ -185,10 +185,10 @@ discard block |
||
| 185 | 185 | * |
| 186 | 186 | * @throws InvalidArgumentException |
| 187 | 187 | */ |
| 188 | - private function setLanguageCode( $languageCode ) { |
|
| 189 | - Assert::parameterType( 'string', $languageCode, '$languageCode' ); |
|
| 190 | - if ( !Language::isValidCode( $languageCode ) ) { |
|
| 191 | - throw new InvalidArgumentException( '$languageCode is not valid.' ); |
|
| 188 | + private function setLanguageCode($languageCode) { |
|
| 189 | + Assert::parameterType('string', $languageCode, '$languageCode'); |
|
| 190 | + if (!Language::isValidCode($languageCode)) { |
|
| 191 | + throw new InvalidArgumentException('$languageCode is not valid.'); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | $this->languageCode = $languageCode; |
@@ -199,12 +199,12 @@ discard block |
||
| 199 | 199 | * |
| 200 | 200 | * @throws InvalidArgumentException |
| 201 | 201 | */ |
| 202 | - private function setImportDate( $importDate ) { |
|
| 203 | - Assert::parameterType( 'string', $importDate, '$importDate' ); |
|
| 202 | + private function setImportDate($importDate) { |
|
| 203 | + Assert::parameterType('string', $importDate, '$importDate'); |
|
| 204 | 204 | |
| 205 | - $timestamp = wfTimestamp( TS_MW, $importDate ); |
|
| 206 | - if ( !$timestamp ) { |
|
| 207 | - throw new InvalidArgumentException( '$updatedAt has invalid timestamp format.' ); |
|
| 205 | + $timestamp = wfTimestamp(TS_MW, $importDate); |
|
| 206 | + if (!$timestamp) { |
|
| 207 | + throw new InvalidArgumentException('$updatedAt has invalid timestamp format.'); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | $this->importDate = $importDate; |
@@ -215,13 +215,13 @@ discard block |
||
| 215 | 215 | * |
| 216 | 216 | * @throws InvalidArgumentException |
| 217 | 217 | */ |
| 218 | - private function setSourceUrl( $sourceUrl ) { |
|
| 219 | - Assert::parameterType( 'string', $sourceUrl, '$sourceUrl' ); |
|
| 220 | - if ( strlen( $sourceUrl ) > 300 ) { |
|
| 221 | - throw new InvalidArgumentException( '$sourceUrl must not be longer than 300 characters.' ); |
|
| 218 | + private function setSourceUrl($sourceUrl) { |
|
| 219 | + Assert::parameterType('string', $sourceUrl, '$sourceUrl'); |
|
| 220 | + if (strlen($sourceUrl) > 300) { |
|
| 221 | + throw new InvalidArgumentException('$sourceUrl must not be longer than 300 characters.'); |
|
| 222 | 222 | } |
| 223 | - if ( !filter_var( $sourceUrl, FILTER_VALIDATE_URL ) ) { |
|
| 224 | - throw new InvalidArgumentException( '$sourceUrl is not a valid url.' ); |
|
| 223 | + if (!filter_var($sourceUrl, FILTER_VALIDATE_URL)) { |
|
| 224 | + throw new InvalidArgumentException('$sourceUrl is not a valid url.'); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | $this->sourceUrl = $sourceUrl; |
@@ -232,10 +232,10 @@ discard block |
||
| 232 | 232 | * |
| 233 | 233 | * @throws InvalidArgumentException |
| 234 | 234 | */ |
| 235 | - private function setSize( $size ) { |
|
| 236 | - Assert::parameterType( 'integer', $size, '$size' ); |
|
| 237 | - if ( $size <= 0 ) { |
|
| 238 | - throw new InvalidArgumentException( '$size must be positive integer.' ); |
|
| 235 | + private function setSize($size) { |
|
| 236 | + Assert::parameterType('integer', $size, '$size'); |
|
| 237 | + if ($size <= 0) { |
|
| 238 | + throw new InvalidArgumentException('$size must be positive integer.'); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | $this->size = $size; |
@@ -73,8 +73,8 @@ |
||
| 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; |
@@ -72,7 +72,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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() |