From c956525e07acdd57fd407d78a49639a86bb5686a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thiemo=20M=C3=A4ttig?= Date: Wed, 28 Jan 2015 13:24:14 +0100 Subject: [PATCH] Release 1.3.0 --- README.md | 3 +++ composer.json | 2 +- src/Deserializers/EntityDeserializer.php | 7 ++++--- src/Serializers/FingerprintSerializer.php | 8 ++++---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 07379323..f7896d92 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,9 @@ and by [Jeroen De Dauw](https://www.mediawiki.org/wiki/User:Jeroen_De_Dauw) as [ ### 1.3.0 (dev) +* `FingerprintSerializer` now supports serializing `AliasGroupFallback`s and `TermFallback`s +* `EntityDeserializer` now fails if the given serialization contains a term or alias that was either + the result of a fallback or transliteration * Added `newTypedSnakSerializer` to `SerializerFactory` ### 1.2.0 (2014-10-15) diff --git a/composer.json b/composer.json index 99791933..a0d3cb4e 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } } } diff --git a/src/Deserializers/EntityDeserializer.php b/src/Deserializers/EntityDeserializer.php index ed283800..45b5ae44 100644 --- a/src/Deserializers/EntityDeserializer.php +++ b/src/Deserializers/EntityDeserializer.php @@ -100,7 +100,7 @@ private function setDescriptionsFromSerialization( array $serialization, Entity private function deserializeValuePerLanguageSerialization( array $serialization ) { $array = array(); - foreach( $serialization as $requestedLanguage => $valueSerialization ) { + foreach ( $serialization as $requestedLanguage => $valueSerialization ) { $this->assertIsValidValueSerialization( $valueSerialization, $requestedLanguage ); $array[$valueSerialization['language']] = $valueSerialization['value']; } @@ -114,12 +114,12 @@ private function setAliasesFromSerialization( array $serialization, Entity $enti } $this->assertAttributeIsArray( $serialization, 'aliases' ); - foreach( $serialization['aliases'] as $requestedLanguage => $aliasesPerLanguageSerialization ) { + foreach ( $serialization['aliases'] as $requestedLanguage => $aliasesPerLanguageSerialization ) { if ( !is_array( $aliasesPerLanguageSerialization ) ) { throw new DeserializationException( "Aliases attribute should be an array of array" ); } - foreach( $aliasesPerLanguageSerialization as $aliasSerialization ) { + foreach ( $aliasesPerLanguageSerialization as $aliasSerialization ) { $this->assertIsValidValueSerialization( $aliasSerialization, $requestedLanguage ); $entity->addAliases( $aliasSerialization['language'], array( $aliasSerialization['value'] ) ); } @@ -165,4 +165,5 @@ private function setClaimsFromSerialization( array $serialization, Entity $entit $statements = new StatementList( iterator_to_array( $claims ) ); $entity->setStatements( $statements ); } + } diff --git a/src/Serializers/FingerprintSerializer.php b/src/Serializers/FingerprintSerializer.php index 35e8d413..54288db3 100644 --- a/src/Serializers/FingerprintSerializer.php +++ b/src/Serializers/FingerprintSerializer.php @@ -63,7 +63,7 @@ public function addDescriptionsToSerialization( Entity $entity, array &$serializ private function serializeValuePerTermList( TermList $list ) { $serialization = array(); - foreach( $list as $term ) { + foreach ( $list as $term ) { $this->serializeTerm( $term, $serialization ); } @@ -95,7 +95,7 @@ public function addAliasesToSerialization( Entity $entity, array &$serialization private function serializeAliasGroupList( AliasGroupList $aliases ) { $serialization = array(); - foreach( $aliases as $aliasGroup ) { + foreach ( $aliases as $aliasGroup ) { $this->serializeAliasGroup( $aliasGroup, $serialization ); } @@ -107,12 +107,12 @@ private function serializeAliasGroupList( AliasGroupList $aliases ) { private function serializeAliasGroup( AliasGroup $aliasGroup, array &$serialization ) { $language = $aliasGroup->getLanguageCode(); - foreach( $aliasGroup->getAliases() as $value ) { + foreach ( $aliasGroup->getAliases() as $value ) { $result = array( 'language' => $language, 'value' => $value ); - if ($aliasGroup instanceof AliasGroupFallback) { + if ( $aliasGroup instanceof AliasGroupFallback ) { $result['language'] = $aliasGroup->getActualLanguageCode(); $result['source'] = $aliasGroup->getSourceLanguageCode(); }