@@ -65,14 +65,14 @@ |
||
65 | 65 | * @param ReferenceResult $referenceResult |
66 | 66 | * @throws InvalidArgumentException |
67 | 67 | */ |
68 | - public function __construct( PropertyId $propertyId, |
|
68 | + public function __construct(PropertyId $propertyId, |
|
69 | 69 | $claimGuid, |
70 | 70 | $externalId, |
71 | 71 | DumpMetaInformation $dumpMetaInformation, |
72 | 72 | ComparisonResult $comparisonResult, |
73 | - ReferenceResult $referenceResult ) { |
|
74 | - Assert::parameterType( 'string', $claimGuid, '$claimGuid' ); |
|
75 | - Assert::parameterType( 'string', $externalId, '$externalId' ); |
|
73 | + ReferenceResult $referenceResult) { |
|
74 | + Assert::parameterType('string', $claimGuid, '$claimGuid'); |
|
75 | + Assert::parameterType('string', $externalId, '$externalId'); |
|
76 | 76 | |
77 | 77 | $this->propertyId = $propertyId; |
78 | 78 | $this->claimGuid = $claimGuid; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @throws InvalidArgumentException |
28 | 28 | */ |
29 | - public function __construct( array $results = array() ) { |
|
29 | + public function __construct(array $results = array()) { |
|
30 | 30 | Assert::parameterElementType( |
31 | 31 | 'WikibaseQuality\ExternalValidation\CrossCheck\Result\CrossCheckResult', |
32 | 32 | $results, |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @param CrossCheckResult $result |
43 | 43 | */ |
44 | - public function add( CrossCheckResult $result ) { |
|
44 | + public function add(CrossCheckResult $result) { |
|
45 | 45 | $this->results[] = $result; |
46 | 46 | } |
47 | 47 | |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @param CrossCheckResultList $resultList |
52 | 52 | */ |
53 | - public function merge( CrossCheckResultList $resultList ) { |
|
54 | - $this->results = array_merge( $this->results, $resultList->results ); |
|
53 | + public function merge(CrossCheckResultList $resultList) { |
|
54 | + $this->results = array_merge($this->results, $resultList->results); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | public function getPropertyIds() { |
63 | 63 | $propertyIds = array(); |
64 | 64 | |
65 | - foreach ( $this->results as $result ) { |
|
65 | + foreach ($this->results as $result) { |
|
66 | 66 | $propertyId = $result->getPropertyId(); |
67 | - if ( !in_array( $propertyId, $propertyIds ) ) { |
|
67 | + if (!in_array($propertyId, $propertyIds)) { |
|
68 | 68 | $propertyIds[] = $propertyId; |
69 | 69 | } |
70 | 70 | } |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @return CrossCheckResultList |
81 | 81 | */ |
82 | - public function getByPropertyId( PropertyId $propertyId ) { |
|
82 | + public function getByPropertyId(PropertyId $propertyId) { |
|
83 | 83 | $results = array(); |
84 | 84 | |
85 | - foreach ( $this->results as $result ) { |
|
86 | - if ( $result->getPropertyId()->equals( $propertyId ) ) { |
|
85 | + foreach ($this->results as $result) { |
|
86 | + if ($result->getPropertyId()->equals($propertyId)) { |
|
87 | 87 | $results[] = $result; |
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | - return new self( $results ); |
|
91 | + return new self($results); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @codeCoverageIgnore |
108 | 108 | */ |
109 | 109 | public function getIterator() { |
110 | - return new ArrayIterator( $this->results ); |
|
110 | + return new ArrayIterator($this->results); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @return int |
117 | 117 | */ |
118 | 118 | public function count() { |
119 | - return count( $this->results ); |
|
119 | + return count($this->results); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | } |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @throws InvalidArgumentException |
38 | 38 | */ |
39 | - public function __construct( $status, Reference $reference ) { |
|
39 | + public function __construct($status, Reference $reference) { |
|
40 | 40 | |
41 | 41 | $this->reference = $reference; |
42 | - $this->setStatus( $status ); |
|
42 | + $this->setStatus($status); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -61,14 +61,14 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @throws InvalidArgumentException |
63 | 63 | */ |
64 | - private function setStatus( $status ) { |
|
65 | - Assert::parameterType( 'string', $status, '$status' ); |
|
66 | - if ( !in_array( |
|
64 | + private function setStatus($status) { |
|
65 | + Assert::parameterType('string', $status, '$status'); |
|
66 | + if (!in_array( |
|
67 | 67 | $status, |
68 | - array( self::STATUS_REFERENCES_MISSING, self::STATUS_REFERENCES_STATED ) |
|
68 | + array(self::STATUS_REFERENCES_MISSING, self::STATUS_REFERENCES_STATED) |
|
69 | 69 | ) |
70 | 70 | ) { |
71 | - throw new InvalidArgumentException( '$status must be one of the status constants.' ); |
|
71 | + throw new InvalidArgumentException('$status must be one of the status constants.'); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | $this->status = $status; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | ValueParserFactory $comparativeValueParserFactory, |
39 | 39 | $languageCode |
40 | 40 | ) { |
41 | - Assert::parameterType( 'string', $languageCode, '$languageCode' ); |
|
41 | + Assert::parameterType('string', $languageCode, '$languageCode'); |
|
42 | 42 | |
43 | 43 | $this->comparativeValueParserFactory = $comparativeValueParserFactory; |
44 | 44 | $this->languageCode = $languageCode; |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return DataValue |
54 | 54 | */ |
55 | - public function parse( $value, $propertyType ) { |
|
56 | - Assert::parameterType( 'string', $value, '$value' ); |
|
57 | - Assert::parameterType( 'string', $propertyType, '$propertyType' ); |
|
55 | + public function parse($value, $propertyType) { |
|
56 | + Assert::parameterType('string', $value, '$value'); |
|
57 | + Assert::parameterType('string', $propertyType, '$propertyType'); |
|
58 | 58 | |
59 | - return $this->getValueParser( $propertyType )->parse( $value ); |
|
59 | + return $this->getValueParser($propertyType)->parse($value); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return ValueParser |
66 | 66 | */ |
67 | - private function getValueParser( $type ) { |
|
68 | - if( !array_key_exists( $type, $this->valueParsers ) ) { |
|
67 | + private function getValueParser($type) { |
|
68 | + if (!array_key_exists($type, $this->valueParsers)) { |
|
69 | 69 | $parserOptions = $this->getParserOptions(); |
70 | 70 | $this->valueParsers[$type] = $this->comparativeValueParserFactory->newParser( |
71 | 71 | $type, |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | */ |
82 | 82 | private function getParserOptions() { |
83 | 83 | $options = new ParserOptions(); |
84 | - $options->setOption( 'valuelang', $this->languageCode ); |
|
85 | - $options->setOption( ValueParser::OPT_LANG, $this->languageCode ); |
|
84 | + $options->setOption('valuelang', $this->languageCode); |
|
85 | + $options->setOption(ValueParser::OPT_LANG, $this->languageCode); |
|
86 | 86 | |
87 | 87 | return $options; |
88 | 88 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | ) { |
44 | 44 | $dataTypeIds = $dataTypeDefinitions->getTypeIds(); |
45 | 45 | |
46 | - if ( !in_array( 'monolingualtext', $dataTypeIds ) ) { |
|
46 | + if (!in_array('monolingualtext', $dataTypeIds)) { |
|
47 | 47 | throw new InvalidArgumentException( |
48 | 48 | 'monolingualtext must be defined in the DataTypeDefinitions.' |
49 | 49 | ); |
@@ -58,21 +58,21 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return MultilingualTextValueParser |
60 | 60 | */ |
61 | - public function newMultilingualTextValueParser( ParserOptions $options = null ) { |
|
61 | + public function newMultilingualTextValueParser(ParserOptions $options = null) { |
|
62 | 62 | $options = $options ?: new ParserOptions(); |
63 | 63 | $monolingualTextValueParser = $this->getValueParserFactory()->newParser( |
64 | 64 | 'monolingualtext', |
65 | 65 | $options |
66 | 66 | ); |
67 | 67 | |
68 | - return new MultilingualTextValueParser( $monolingualTextValueParser ); |
|
68 | + return new MultilingualTextValueParser($monolingualTextValueParser); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * @return StringValueParser |
73 | 73 | */ |
74 | 74 | public function newStringValueParser() { |
75 | - return new StringValueParser( $this->stringNormalizer ); |
|
75 | + return new StringValueParser($this->stringNormalizer); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return ComparativeValueParser |
82 | 82 | */ |
83 | - public function newComparativeValueParser( $languageCode ) { |
|
84 | - Assert::parameterType( 'string', $languageCode, '$languageCode' ); |
|
83 | + public function newComparativeValueParser($languageCode) { |
|
84 | + Assert::parameterType('string', $languageCode, '$languageCode'); |
|
85 | 85 | |
86 | 86 | return new ComparativeValueParser( |
87 | 87 | $this->getValueParserFactory(), |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | * @return ValueParserFactory |
101 | 101 | */ |
102 | 102 | private function getValueParserFactory() { |
103 | - if ( $this->valueParserFactory === null ) { |
|
103 | + if ($this->valueParserFactory === null) { |
|
104 | 104 | $callbacks = $this->dataTypeDefinitions->getParserFactoryCallbacks(); |
105 | 105 | |
106 | - $callbacks['string'] = array( $this, 'newStringValueParser' ); |
|
107 | - $callbacks['multilingualtext'] = array( $this, 'newMultilingualTextValueParser' ); |
|
106 | + $callbacks['string'] = array($this, 'newStringValueParser'); |
|
107 | + $callbacks['multilingualtext'] = array($this, 'newMultilingualTextValueParser'); |
|
108 | 108 | $callbacks['wikibase-entityid'] = $callbacks['monolingualtext']; |
109 | 109 | |
110 | - $this->valueParserFactory = new ValueParserFactory( $callbacks ); |
|
110 | + $this->valueParserFactory = new ValueParserFactory($callbacks); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $this->valueParserFactory; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @param ValueParser $monolingualTextValueParser |
23 | 23 | */ |
24 | - public function __construct( ValueParser $monolingualTextValueParser ) { |
|
24 | + public function __construct(ValueParser $monolingualTextValueParser) { |
|
25 | 25 | $this->monolingualTextValueParser = $monolingualTextValueParser; |
26 | 26 | } |
27 | 27 | |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @return MultilingualTextValue |
34 | 34 | */ |
35 | - public function parse( $value ) { |
|
36 | - Assert::parameterType( 'string', $value, '$value' ); |
|
35 | + public function parse($value) { |
|
36 | + Assert::parameterType('string', $value, '$value'); |
|
37 | 37 | |
38 | 38 | return new MultilingualTextValue( |
39 | - array( $this->monolingualTextValueParser->parse( $value ) ) |
|
39 | + array($this->monolingualTextValueParser->parse($value)) |
|
40 | 40 | ); |
41 | 41 | } |
42 | 42 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * @param StringNormalizer $stringNormalizer |
19 | 19 | */ |
20 | - public function __construct( StringNormalizer $stringNormalizer ) { |
|
20 | + public function __construct(StringNormalizer $stringNormalizer) { |
|
21 | 21 | $this->stringNormalizer = $stringNormalizer; |
22 | 22 | } |
23 | 23 | |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return StringValue |
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 | - return new StringValue( $this->stringNormalizer->trimToNFC( $value ) ); |
|
34 | + return new StringValue($this->stringNormalizer->trimToNFC($value)); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | } |
@@ -84,27 +84,27 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @throws InvalidArgumentException |
86 | 86 | */ |
87 | - public function __construct( $dumpId, |
|
87 | + public function __construct($dumpId, |
|
88 | 88 | ItemId $sourceItemId, |
89 | 89 | array $identifierPropertyIds, |
90 | 90 | $importDate, |
91 | 91 | $languageCode, |
92 | 92 | $sourceUrl, |
93 | 93 | $size, |
94 | - ItemId $licenseItemId ) { |
|
94 | + ItemId $licenseItemId) { |
|
95 | 95 | Assert::parameterElementType( |
96 | 96 | 'Wikibase\DataModel\Entity\PropertyId', |
97 | 97 | $identifierPropertyIds, |
98 | 98 | '$identifierPropertyIds' |
99 | 99 | ); |
100 | 100 | |
101 | - $this->setDumpId( $dumpId ); |
|
101 | + $this->setDumpId($dumpId); |
|
102 | 102 | $this->sourceItemId = $sourceItemId; |
103 | 103 | $this->identifierPropertyIds = $identifierPropertyIds; |
104 | - $this->setImportDate( $importDate ); |
|
105 | - $this->setLanguageCode( $languageCode ); |
|
106 | - $this->setSourceUrl( $sourceUrl ); |
|
107 | - $this->setSize( $size ); |
|
104 | + $this->setImportDate($importDate); |
|
105 | + $this->setLanguageCode($languageCode); |
|
106 | + $this->setSourceUrl($sourceUrl); |
|
107 | + $this->setSize($size); |
|
108 | 108 | $this->licenseItemId = $licenseItemId; |
109 | 109 | } |
110 | 110 | |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | /** |
168 | 168 | * @param string $dumpId |
169 | 169 | */ |
170 | - private function setDumpId( $dumpId ) { |
|
171 | - Assert::parameterType( 'string', $dumpId, '$dumpId' ); |
|
172 | - $length = strlen( $dumpId ); |
|
173 | - if( $length === 0 && $length > 25 ) { |
|
170 | + private function setDumpId($dumpId) { |
|
171 | + Assert::parameterType('string', $dumpId, '$dumpId'); |
|
172 | + $length = strlen($dumpId); |
|
173 | + if ($length === 0 && $length > 25) { |
|
174 | 174 | throw new InvalidArgumentException('$dumpId must be between 1 and 25 characters.'); |
175 | 175 | } |
176 | 176 | |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | /** |
181 | 181 | * @param string $languageCode |
182 | 182 | */ |
183 | - private function setLanguageCode( $languageCode ) { |
|
184 | - Assert::parameterType( 'string', $languageCode, '$languageCode' ); |
|
185 | - if( !Language::isValidCode( $languageCode ) ) { |
|
186 | - throw new InvalidArgumentException( '$languageCode is not valid.' ); |
|
183 | + private function setLanguageCode($languageCode) { |
|
184 | + Assert::parameterType('string', $languageCode, '$languageCode'); |
|
185 | + if (!Language::isValidCode($languageCode)) { |
|
186 | + throw new InvalidArgumentException('$languageCode is not valid.'); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | $this->languageCode = $languageCode; |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | /** |
192 | 192 | * @param string $importDate |
193 | 193 | */ |
194 | - private function setImportDate( $importDate ) { |
|
195 | - Assert::parameterType( 'string', $importDate, '$importDate' ); |
|
194 | + private function setImportDate($importDate) { |
|
195 | + Assert::parameterType('string', $importDate, '$importDate'); |
|
196 | 196 | |
197 | - $timestamp = wfTimestamp( TS_MW, $importDate ); |
|
198 | - if( !$timestamp ) { |
|
199 | - throw new InvalidArgumentException( '$updatedAt has invalid timestamp format.' ); |
|
197 | + $timestamp = wfTimestamp(TS_MW, $importDate); |
|
198 | + if (!$timestamp) { |
|
199 | + throw new InvalidArgumentException('$updatedAt has invalid timestamp format.'); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | $this->importDate = $importDate; |
@@ -205,13 +205,13 @@ discard block |
||
205 | 205 | /** |
206 | 206 | * @param string $sourceUrl |
207 | 207 | */ |
208 | - private function setSourceUrl( $sourceUrl ) { |
|
209 | - Assert::parameterType( 'string', $sourceUrl, '$sourceUrl' ); |
|
210 | - if( strlen( $sourceUrl ) > 300 ) { |
|
211 | - throw new InvalidArgumentException( '$sourceUrl must not be longer than 300 characters.' ); |
|
208 | + private function setSourceUrl($sourceUrl) { |
|
209 | + Assert::parameterType('string', $sourceUrl, '$sourceUrl'); |
|
210 | + if (strlen($sourceUrl) > 300) { |
|
211 | + throw new InvalidArgumentException('$sourceUrl must not be longer than 300 characters.'); |
|
212 | 212 | } |
213 | - if( !filter_var($sourceUrl, FILTER_VALIDATE_URL) ) { |
|
214 | - throw new InvalidArgumentException( '$sourceUrl is not a valid url.' ); |
|
213 | + if (!filter_var($sourceUrl, FILTER_VALIDATE_URL)) { |
|
214 | + throw new InvalidArgumentException('$sourceUrl is not a valid url.'); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | $this->sourceUrl = $sourceUrl; |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | /** |
221 | 221 | * @param int $size |
222 | 222 | */ |
223 | - private function setSize( $size ){ |
|
224 | - Assert::parameterType( 'integer', $size, '$size' ); |
|
225 | - if( $size <= 0 ) { |
|
226 | - throw new InvalidArgumentException( '$size must be positive integer.' ); |
|
223 | + private function setSize($size) { |
|
224 | + Assert::parameterType('integer', $size, '$size'); |
|
225 | + if ($size <= 0) { |
|
226 | + throw new InvalidArgumentException('$size must be positive integer.'); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | $this->size = $size; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @return DumpMetaInformation |
21 | 21 | * @throws \InvalidArgumentException |
22 | 22 | */ |
23 | - public function getWithId( $dumpId ); |
|
23 | + public function getWithId($dumpId); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Gets DumpMetaInformation for specific dump ids from database |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @return DumpMetaInformation[] |
31 | 31 | * @throws \InvalidArgumentException |
32 | 32 | */ |
33 | - public function getWithIds( array $dumpIds ); |
|
33 | + public function getWithIds(array $dumpIds); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Gets DumpMetaInformation for specific identifier properties from database |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return DumpMetaInformation[] |
42 | 42 | */ |
43 | - public function getWithIdentifierProperties( array $identifierPropertyIds ); |
|
43 | + public function getWithIdentifierProperties(array $identifierPropertyIds); |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * Gets id of item that represents the data source for each dump. |