@@ -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() |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | private $stringComparer; |
| 19 | 19 | |
| 20 | - public function __construct( StringComparer $stringComparer ) { |
|
| 20 | + public function __construct(StringComparer $stringComparer) { |
|
| 21 | 21 | $this->stringComparer = $stringComparer; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -30,12 +30,12 @@ discard block |
||
| 30 | 30 | * @throws InvalidArgumentException |
| 31 | 31 | * @return string One of the ComparisonResult::STATUS_... constants. |
| 32 | 32 | */ |
| 33 | - public function compare( DataValue $value, DataValue $comparativeValue ) { |
|
| 34 | - if ( !$this->canCompare( $value, $comparativeValue ) ) { |
|
| 35 | - throw new InvalidArgumentException( 'Given values can not be compared using this comparer.' ); |
|
| 33 | + public function compare(DataValue $value, DataValue $comparativeValue) { |
|
| 34 | + if (!$this->canCompare($value, $comparativeValue)) { |
|
| 35 | + throw new InvalidArgumentException('Given values can not be compared using this comparer.'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - return $this->stringComparer->compare( $value->getValue(), $comparativeValue->getValue() ); |
|
| 38 | + return $this->stringComparer->compare($value->getValue(), $comparativeValue->getValue()); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param DataValue $comparativeValue |
| 46 | 46 | * @return bool |
| 47 | 47 | */ |
| 48 | - public function canCompare( DataValue $value, DataValue $comparativeValue ) { |
|
| 48 | + public function canCompare(DataValue $value, DataValue $comparativeValue) { |
|
| 49 | 49 | return $value instanceof StringValue && $comparativeValue instanceof StringValue; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | private $stringComparer; |
| 19 | 19 | |
| 20 | - public function __construct( StringComparer $stringComparer ) { |
|
| 20 | + public function __construct(StringComparer $stringComparer) { |
|
| 21 | 21 | $this->stringComparer = $stringComparer; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | * @throws InvalidArgumentException |
| 31 | 31 | * @return string|null One of the ComparisonResult::STATUS_... constants. |
| 32 | 32 | */ |
| 33 | - public function compare( DataValue $value, DataValue $comparativeValue ) { |
|
| 34 | - if ( !$this->canCompare( $value, $comparativeValue ) ) { |
|
| 35 | - throw new InvalidArgumentException( 'Given values can not be compared using this comparer.' ); |
|
| 33 | + public function compare(DataValue $value, DataValue $comparativeValue) { |
|
| 34 | + if (!$this->canCompare($value, $comparativeValue)) { |
|
| 35 | + throw new InvalidArgumentException('Given values can not be compared using this comparer.'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | * @var MonolingualTextValue $comparativeValue |
| 41 | 41 | */ |
| 42 | 42 | |
| 43 | - if ( $value->getLanguageCode() === $comparativeValue->getLanguageCode() ) { |
|
| 44 | - return $this->stringComparer->compare( $value->getText(), $comparativeValue->getText() ); |
|
| 43 | + if ($value->getLanguageCode() === $comparativeValue->getLanguageCode()) { |
|
| 44 | + return $this->stringComparer->compare($value->getText(), $comparativeValue->getText()); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | return null; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @param DataValue $comparativeValue |
| 55 | 55 | * @return bool |
| 56 | 56 | */ |
| 57 | - public function canCompare( DataValue $value, DataValue $comparativeValue ) { |
|
| 57 | + public function canCompare(DataValue $value, DataValue $comparativeValue) { |
|
| 58 | 58 | return $value instanceof MonolingualTextValue && $comparativeValue instanceof MonolingualTextValue; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | private $stringComparer; |
| 20 | 20 | |
| 21 | - public function __construct( StringComparer $stringComparer ) { |
|
| 21 | + public function __construct(StringComparer $stringComparer) { |
|
| 22 | 22 | $this->stringComparer = $stringComparer; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * @throws InvalidArgumentException |
| 32 | 32 | * @return string|null One of the ComparisonResult::STATUS_... constants. |
| 33 | 33 | */ |
| 34 | - public function compare( DataValue $value, DataValue $comparativeValue ) { |
|
| 35 | - if ( !$this->canCompare( $value, $comparativeValue ) ) { |
|
| 36 | - throw new InvalidArgumentException( 'Given values can not be compared using this comparer.' ); |
|
| 34 | + public function compare(DataValue $value, DataValue $comparativeValue) { |
|
| 35 | + if (!$this->canCompare($value, $comparativeValue)) { |
|
| 36 | + throw new InvalidArgumentException('Given values can not be compared using this comparer.'); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -43,21 +43,21 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $texts = $value->getTexts(); |
| 45 | 45 | $comparativeTexts = $comparativeValue->getTexts(); |
| 46 | - $commonLanguages = array_intersect( array_keys( $texts ), array_keys( $comparativeTexts ) ); |
|
| 46 | + $commonLanguages = array_intersect(array_keys($texts), array_keys($comparativeTexts)); |
|
| 47 | 47 | |
| 48 | - if ( $commonLanguages ) { |
|
| 48 | + if ($commonLanguages) { |
|
| 49 | 49 | $totalResult = ComparisonResult::STATUS_MISMATCH; |
| 50 | 50 | |
| 51 | - foreach ( $commonLanguages as $language ) { |
|
| 51 | + foreach ($commonLanguages as $language) { |
|
| 52 | 52 | $monolingualText = $texts[$language]; |
| 53 | 53 | $comparativeMonolingualText = $comparativeTexts[$language]; |
| 54 | 54 | |
| 55 | - $result = $this->stringComparer->compare( $monolingualText->getText(), $comparativeMonolingualText->getText() ); |
|
| 56 | - if ( $result !== ComparisonResult::STATUS_MISMATCH ) { |
|
| 55 | + $result = $this->stringComparer->compare($monolingualText->getText(), $comparativeMonolingualText->getText()); |
|
| 56 | + if ($result !== ComparisonResult::STATUS_MISMATCH) { |
|
| 57 | 57 | $totalResult = $result; |
| 58 | 58 | |
| 59 | 59 | // FIXME: This reports a partial match in a single language as a full match! |
| 60 | - if ( $result === ComparisonResult::STATUS_MATCH ) { |
|
| 60 | + if ($result === ComparisonResult::STATUS_MATCH) { |
|
| 61 | 61 | break; |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @param DataValue $comparativeValue |
| 77 | 77 | * @return bool |
| 78 | 78 | */ |
| 79 | - public function canCompare( DataValue $value, DataValue $comparativeValue ) { |
|
| 79 | + public function canCompare(DataValue $value, DataValue $comparativeValue) { |
|
| 80 | 80 | return $value instanceof MultilingualTextValue && $comparativeValue instanceof MultilingualTextValue; |
| 81 | 81 | } |
| 82 | 82 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | private $stringNormalizer; |
| 23 | 23 | |
| 24 | - public function __construct( TermIndex $termIndex, StringNormalizer $stringNormalizer ) { |
|
| 24 | + public function __construct(TermIndex $termIndex, StringNormalizer $stringNormalizer) { |
|
| 25 | 25 | $this->termIndex = $termIndex; |
| 26 | 26 | $this->stringNormalizer = $stringNormalizer; |
| 27 | 27 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @return StringComparer |
| 64 | 64 | */ |
| 65 | 65 | private function newStringComparer() { |
| 66 | - return new StringComparer( $this->stringNormalizer ); |
|
| 66 | + return new StringComparer($this->stringNormalizer); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | private $stringNormalizer; |
| 20 | 20 | |
| 21 | - public function __construct( StringNormalizer $stringNormalizer ) { |
|
| 21 | + public function __construct(StringNormalizer $stringNormalizer) { |
|
| 22 | 22 | $this->stringNormalizer = $stringNormalizer; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -29,10 +29,10 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @return StringValue |
| 31 | 31 | */ |
| 32 | - public function parse( $value ) { |
|
| 33 | - Assert::parameterType( 'string', $value, '$value' ); |
|
| 32 | + public function parse($value) { |
|
| 33 | + Assert::parameterType('string', $value, '$value'); |
|
| 34 | 34 | |
| 35 | - return new StringValue( $this->stringNormalizer->trimToNFC( $value ) ); |
|
| 35 | + return new StringValue($this->stringNormalizer->trimToNFC($value)); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | private $monolingualTextValueParser; |
| 19 | 19 | |
| 20 | - public function __construct( ValueParser $monolingualTextValueParser ) { |
|
| 20 | + public function __construct(ValueParser $monolingualTextValueParser) { |
|
| 21 | 21 | $this->monolingualTextValueParser = $monolingualTextValueParser; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @return MultilingualTextValue |
| 30 | 30 | */ |
| 31 | - public function parse( $value ) { |
|
| 32 | - Assert::parameterType( 'string', $value, '$value' ); |
|
| 31 | + public function parse($value) { |
|
| 32 | + Assert::parameterType('string', $value, '$value'); |
|
| 33 | 33 | |
| 34 | 34 | return new MultilingualTextValue( |
| 35 | - [ $this->monolingualTextValueParser->parse( $value ) ] |
|
| 35 | + [$this->monolingualTextValueParser->parse($value)] |
|
| 36 | 36 | ); |
| 37 | 37 | } |
| 38 | 38 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | private $referenceSerializer; |
| 22 | 22 | |
| 23 | - public function __construct( Serializer $dataValueSerializer, Serializer $referenceSerializer ) { |
|
| 23 | + public function __construct(Serializer $dataValueSerializer, Serializer $referenceSerializer) { |
|
| 24 | 24 | $this->dataValueSerializer = $dataValueSerializer; |
| 25 | 25 | $this->referenceSerializer = $referenceSerializer; |
| 26 | 26 | } |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @return Serializer |
| 43 | 43 | */ |
| 44 | 44 | public function newComparisonResultSerializer() { |
| 45 | - return new ComparisonResultSerializer( $this->dataValueSerializer ); |
|
| 45 | + return new ComparisonResultSerializer($this->dataValueSerializer); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * @return Serializer |
| 74 | 74 | */ |
| 75 | 75 | public function newReferenceResultSerializer() { |
| 76 | - return new ReferenceResultSerializer( $this->referenceSerializer ); |
|
| 76 | + return new ReferenceResultSerializer($this->referenceSerializer); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | } |