@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return bool |
20 | 20 | */ |
21 | - public function canCompare( DataValue $value, DataValue $comparativeValue ); |
|
21 | + public function canCompare(DataValue $value, DataValue $comparativeValue); |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Runs the comparison of two DataValues. |
@@ -28,6 +28,6 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return string One of the ComparisonResult::STATUS_... constants. |
30 | 30 | */ |
31 | - public function compare( DataValue $value, DataValue $comparativeValue ); |
|
31 | + public function compare(DataValue $value, DataValue $comparativeValue); |
|
32 | 32 | |
33 | 33 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param TermIndex $termIndex |
27 | 27 | * @param StringNormalizer $stringNormalizer |
28 | 28 | */ |
29 | - public function __construct( TermIndex $termIndex, StringNormalizer $stringNormalizer ) { |
|
29 | + public function __construct(TermIndex $termIndex, StringNormalizer $stringNormalizer) { |
|
30 | 30 | $this->termIndex = $termIndex; |
31 | 31 | $this->stringNormalizer = $stringNormalizer; |
32 | 32 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return StringComparer |
69 | 69 | */ |
70 | 70 | private function newStringComparer() { |
71 | - return new StringComparer( $this->stringNormalizer ); |
|
71 | + return new StringComparer($this->stringNormalizer); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | * @throws InvalidArgumentException |
24 | 24 | * @return string One of the ComparisonResult::STATUS_... constants. |
25 | 25 | */ |
26 | - public function compare( DataValue $value, DataValue $comparativeValue ) { |
|
27 | - if ( !$this->canCompare( $value, $comparativeValue ) ) { |
|
28 | - throw new InvalidArgumentException( 'Given values can not be compared using this comparer.' ); |
|
26 | + public function compare(DataValue $value, DataValue $comparativeValue) { |
|
27 | + if (!$this->canCompare($value, $comparativeValue)) { |
|
28 | + throw new InvalidArgumentException('Given values can not be compared using this comparer.'); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | $extLat = $comparativeValue->getLatitude(); |
40 | 40 | $extLong = $comparativeValue->getLongitude(); |
41 | 41 | |
42 | - $diffLat = abs( $locLat - $extLat ); |
|
43 | - $diffLong = abs( $locLong - $extLong ); |
|
44 | - if ( ( $diffLat <= $precision ) && ( $diffLong <= $precision ) ) { |
|
42 | + $diffLat = abs($locLat - $extLat); |
|
43 | + $diffLong = abs($locLong - $extLong); |
|
44 | + if (($diffLat <= $precision) && ($diffLong <= $precision)) { |
|
45 | 45 | return ComparisonResult::STATUS_MATCH; |
46 | 46 | } |
47 | 47 | |
48 | 48 | $daumen = $precision; |
49 | - if ( ( $diffLat <= pi() * $daumen ) && ( $diffLong <= pi() * $daumen ) ) { |
|
49 | + if (($diffLat <= pi() * $daumen) && ($diffLong <= pi() * $daumen)) { |
|
50 | 50 | return ComparisonResult::STATUS_PARTIAL_MATCH; |
51 | 51 | } |
52 | 52 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param DataValue $comparativeValue |
61 | 61 | * @return bool |
62 | 62 | */ |
63 | - public function canCompare( DataValue $value, DataValue $comparativeValue ) { |
|
63 | + public function canCompare(DataValue $value, DataValue $comparativeValue) { |
|
64 | 64 | return $value instanceof GlobeCoordinateValue && $comparativeValue instanceof GlobeCoordinateValue; |
65 | 65 | } |
66 | 66 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @param StringComparer $stringComparer |
24 | 24 | */ |
25 | - public function __construct( StringComparer $stringComparer ) { |
|
25 | + public function __construct(StringComparer $stringComparer) { |
|
26 | 26 | $this->stringComparer = $stringComparer; |
27 | 27 | } |
28 | 28 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @throws InvalidArgumentException |
36 | 36 | * @return string|null One of the ComparisonResult::STATUS_... constants. |
37 | 37 | */ |
38 | - public function compare( DataValue $value, DataValue $comparativeValue ) { |
|
39 | - if ( !$this->canCompare( $value, $comparativeValue ) ) { |
|
40 | - throw new InvalidArgumentException( 'Given values can not be compared using this comparer.' ); |
|
38 | + public function compare(DataValue $value, DataValue $comparativeValue) { |
|
39 | + if (!$this->canCompare($value, $comparativeValue)) { |
|
40 | + throw new InvalidArgumentException('Given values can not be compared using this comparer.'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | * @var MonolingualTextValue $comparativeValue |
46 | 46 | */ |
47 | 47 | |
48 | - if ( $value->getLanguageCode() === $comparativeValue->getLanguageCode() ) { |
|
49 | - return $this->stringComparer->compare( $value->getText(), $comparativeValue->getText() ); |
|
48 | + if ($value->getLanguageCode() === $comparativeValue->getLanguageCode()) { |
|
49 | + return $this->stringComparer->compare($value->getText(), $comparativeValue->getText()); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | return null; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param DataValue $comparativeValue |
60 | 60 | * @return bool |
61 | 61 | */ |
62 | - public function canCompare( DataValue $value, DataValue $comparativeValue ) { |
|
62 | + public function canCompare(DataValue $value, DataValue $comparativeValue) { |
|
63 | 63 | return $value instanceof MonolingualTextValue && $comparativeValue instanceof MonolingualTextValue; |
64 | 64 | } |
65 | 65 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * @param StringComparer $stringComparer |
24 | 24 | */ |
25 | - public function __construct( StringComparer $stringComparer ) { |
|
25 | + public function __construct(StringComparer $stringComparer) { |
|
26 | 26 | $this->stringComparer = $stringComparer; |
27 | 27 | } |
28 | 28 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @throws InvalidArgumentException |
36 | 36 | * @return string|null One of the ComparisonResult::STATUS_... constants. |
37 | 37 | */ |
38 | - public function compare( DataValue $value, DataValue $comparativeValue ) { |
|
39 | - if ( !$this->canCompare( $value, $comparativeValue ) ) { |
|
40 | - throw new InvalidArgumentException( 'Given values can not be compared using this comparer.' ); |
|
38 | + public function compare(DataValue $value, DataValue $comparativeValue) { |
|
39 | + if (!$this->canCompare($value, $comparativeValue)) { |
|
40 | + throw new InvalidArgumentException('Given values can not be compared using this comparer.'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -47,21 +47,21 @@ discard block |
||
47 | 47 | |
48 | 48 | $texts = $value->getTexts(); |
49 | 49 | $comparativeTexts = $comparativeValue->getTexts(); |
50 | - $commonLanguages = array_intersect( array_keys( $texts ), array_keys( $comparativeTexts ) ); |
|
50 | + $commonLanguages = array_intersect(array_keys($texts), array_keys($comparativeTexts)); |
|
51 | 51 | |
52 | - if ( $commonLanguages ) { |
|
52 | + if ($commonLanguages) { |
|
53 | 53 | $totalResult = ComparisonResult::STATUS_MISMATCH; |
54 | 54 | |
55 | - foreach ( $commonLanguages as $language ) { |
|
55 | + foreach ($commonLanguages as $language) { |
|
56 | 56 | $monolingualText = $texts[$language]; |
57 | 57 | $comparativeMonolingualText = $comparativeTexts[$language]; |
58 | 58 | |
59 | - $result = $this->stringComparer->compare( $monolingualText->getText(), $comparativeMonolingualText->getText() ); |
|
60 | - if ( $result !== ComparisonResult::STATUS_MISMATCH ) { |
|
59 | + $result = $this->stringComparer->compare($monolingualText->getText(), $comparativeMonolingualText->getText()); |
|
60 | + if ($result !== ComparisonResult::STATUS_MISMATCH) { |
|
61 | 61 | $totalResult = $result; |
62 | 62 | |
63 | 63 | // FIXME: This reports a partial match in a single language as a full match! |
64 | - if ( $result === ComparisonResult::STATUS_MATCH ) { |
|
64 | + if ($result === ComparisonResult::STATUS_MATCH) { |
|
65 | 65 | break; |
66 | 66 | } |
67 | 67 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param DataValue $comparativeValue |
81 | 81 | * @return bool |
82 | 82 | */ |
83 | - public function canCompare( DataValue $value, DataValue $comparativeValue ) { |
|
83 | + public function canCompare(DataValue $value, DataValue $comparativeValue) { |
|
84 | 84 | return $value instanceof MultilingualTextValue && $comparativeValue instanceof MultilingualTextValue; |
85 | 85 | } |
86 | 86 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @param StringComparer $stringComparer |
23 | 23 | */ |
24 | - public function __construct( StringComparer $stringComparer ) { |
|
24 | + public function __construct(StringComparer $stringComparer) { |
|
25 | 25 | $this->stringComparer = $stringComparer; |
26 | 26 | } |
27 | 27 | |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | * @throws InvalidArgumentException |
35 | 35 | * @return string One of the ComparisonResult::STATUS_... constants. |
36 | 36 | */ |
37 | - public function compare( DataValue $value, DataValue $comparativeValue ) { |
|
38 | - if ( !$this->canCompare( $value, $comparativeValue ) ) { |
|
39 | - throw new InvalidArgumentException( 'Given values can not be compared using this comparer.' ); |
|
37 | + public function compare(DataValue $value, DataValue $comparativeValue) { |
|
38 | + if (!$this->canCompare($value, $comparativeValue)) { |
|
39 | + throw new InvalidArgumentException('Given values can not be compared using this comparer.'); |
|
40 | 40 | } |
41 | 41 | |
42 | - return $this->stringComparer->compare( $value->getValue(), $comparativeValue->getValue() ); |
|
42 | + return $this->stringComparer->compare($value->getValue(), $comparativeValue->getValue()); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param DataValue $comparativeValue |
50 | 50 | * @return bool |
51 | 51 | */ |
52 | - public function canCompare( DataValue $value, DataValue $comparativeValue ) { |
|
52 | + public function canCompare(DataValue $value, DataValue $comparativeValue) { |
|
53 | 53 | return $value instanceof StringValue && $comparativeValue instanceof StringValue; |
54 | 54 | } |
55 | 55 |
@@ -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 | } |
@@ -15,6 +15,6 @@ |
||
15 | 15 | * |
16 | 16 | * @param DumpMetaInformation $dumpMetaInformation |
17 | 17 | */ |
18 | - public function save( DumpMetaInformation $dumpMetaInformation ); |
|
18 | + public function save(DumpMetaInformation $dumpMetaInformation); |
|
19 | 19 | |
20 | 20 | } |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | * @param array &$arr |
21 | 21 | * @param string $tag |
22 | 22 | */ |
23 | - protected function setIndexedTagName( array &$arr, $tag ) { |
|
24 | - ApiResult::setIndexedTagName( $arr, $tag ); |
|
23 | + protected function setIndexedTagName(array &$arr, $tag) { |
|
24 | + ApiResult::setIndexedTagName($arr, $tag); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | * @param string $tagName |
34 | 34 | * @param string $idAttribute |
35 | 35 | */ |
36 | - protected function setKeyAttributeName( array &$arr, $tagName, $idAttribute ) { |
|
37 | - ApiResult::setArrayType( $arr, 'kvp', $idAttribute ); |
|
38 | - ApiResult::setIndexedTagName( $arr, $tagName ); |
|
36 | + protected function setKeyAttributeName(array &$arr, $tagName, $idAttribute) { |
|
37 | + ApiResult::setArrayType($arr, 'kvp', $idAttribute); |
|
38 | + ApiResult::setIndexedTagName($arr, $tagName); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | } |