@@ -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 | } |
@@ -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 | } |
@@ -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 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 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; |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | /** |
| 23 | 23 | * @param Serializer $dataValueSerializer |
| 24 | 24 | */ |
| 25 | - public function __construct( Serializer $dataValueSerializer ) { |
|
| 25 | + public function __construct(Serializer $dataValueSerializer) { |
|
| 26 | 26 | $this->dataValueSerializer = $dataValueSerializer; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @return bool |
| 35 | 35 | */ |
| 36 | - public function isSerializerFor( $object ) { |
|
| 36 | + public function isSerializerFor($object) { |
|
| 37 | 37 | return $object instanceof ComparisonResult; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -45,29 +45,29 @@ discard block |
||
| 45 | 45 | * @return array |
| 46 | 46 | * @throws UnsupportedObjectException |
| 47 | 47 | */ |
| 48 | - public function serialize( $object ) { |
|
| 49 | - if ( !$this->isSerializerFor( $object ) ) { |
|
| 48 | + public function serialize($object) { |
|
| 49 | + if (!$this->isSerializerFor($object)) { |
|
| 50 | 50 | throw new UnsupportedObjectException( |
| 51 | 51 | $object, |
| 52 | 52 | 'ComparisonResultSerializer can only serialize ComparisonResult objects.' |
| 53 | 53 | ); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - return $this->getSerialized( $object ); |
|
| 56 | + return $this->getSerialized($object); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - private function getSerialized( ComparisonResult $comparisonResult ) { |
|
| 59 | + private function getSerialized(ComparisonResult $comparisonResult) { |
|
| 60 | 60 | $dataValueSerializer = $this->dataValueSerializer; |
| 61 | 61 | $externalValues = array_map( |
| 62 | - function ( $dataValue ) use ( $dataValueSerializer ) { |
|
| 63 | - return $dataValueSerializer->serialize( $dataValue ); |
|
| 62 | + function($dataValue) use ($dataValueSerializer) { |
|
| 63 | + return $dataValueSerializer->serialize($dataValue); |
|
| 64 | 64 | }, |
| 65 | 65 | $comparisonResult->getExternalValues() |
| 66 | 66 | ); |
| 67 | - $this->setIndexedTagName( $externalValues, 'dataValue' ); |
|
| 67 | + $this->setIndexedTagName($externalValues, 'dataValue'); |
|
| 68 | 68 | |
| 69 | 69 | return array( |
| 70 | - 'localValue' => $this->dataValueSerializer->serialize( $comparisonResult->getLocalValue() ), |
|
| 70 | + 'localValue' => $this->dataValueSerializer->serialize($comparisonResult->getLocalValue()), |
|
| 71 | 71 | 'externalValues' => $externalValues, |
| 72 | 72 | 'result' => $comparisonResult->getStatus() |
| 73 | 73 | ); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | /** |
| 23 | 23 | * @param Serializer $crossCheckResultSerializer |
| 24 | 24 | */ |
| 25 | - public function __construct( Serializer $crossCheckResultSerializer ) { |
|
| 25 | + public function __construct(Serializer $crossCheckResultSerializer) { |
|
| 26 | 26 | $this->crossCheckResultSerializer = $crossCheckResultSerializer; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @return bool |
| 35 | 35 | */ |
| 36 | - public function isSerializerFor( $object ) { |
|
| 36 | + public function isSerializerFor($object) { |
|
| 37 | 37 | return $object instanceof CrossCheckResultList; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -45,29 +45,29 @@ discard block |
||
| 45 | 45 | * @return array |
| 46 | 46 | * @throws UnsupportedObjectException |
| 47 | 47 | */ |
| 48 | - public function serialize( $object ) { |
|
| 49 | - if ( !$this->isSerializerFor( $object ) ) { |
|
| 48 | + public function serialize($object) { |
|
| 49 | + if (!$this->isSerializerFor($object)) { |
|
| 50 | 50 | throw new UnsupportedObjectException( |
| 51 | 51 | $object, |
| 52 | 52 | 'CrossCheckResultListSerializer can only serialize CrossCheckResultList objects.' |
| 53 | 53 | ); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - return $this->getSerialized( $object ); |
|
| 56 | + return $this->getSerialized($object); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - private function getSerialized( CrossCheckResultList $resultList ) { |
|
| 59 | + private function getSerialized(CrossCheckResultList $resultList) { |
|
| 60 | 60 | $serialization = array(); |
| 61 | - $this->setKeyAttributeName( $serialization, 'property', 'id' ); |
|
| 61 | + $this->setKeyAttributeName($serialization, 'property', 'id'); |
|
| 62 | 62 | |
| 63 | - foreach ( $resultList->getPropertyIds() as $propertyId ) { |
|
| 63 | + foreach ($resultList->getPropertyIds() as $propertyId) { |
|
| 64 | 64 | $id = $propertyId->getSerialization(); |
| 65 | 65 | $resultSerialization = array(); |
| 66 | 66 | |
| 67 | - $this->setIndexedTagName( $resultSerialization, 'result' ); |
|
| 67 | + $this->setIndexedTagName($resultSerialization, 'result'); |
|
| 68 | 68 | |
| 69 | - foreach ( $resultList->getByPropertyId( $propertyId ) as $result ) { |
|
| 70 | - $resultSerialization[] = $this->crossCheckResultSerializer->serialize( $result ); |
|
| 69 | + foreach ($resultList->getByPropertyId($propertyId) as $result) { |
|
| 70 | + $resultSerialization[] = $this->crossCheckResultSerializer->serialize($result); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $serialization[$id] = $resultSerialization; |