Skip to content

Commit

Permalink
Merge pull request #104 from wmde/0130
Browse files Browse the repository at this point in the history
Release 1.3.0
  • Loading branch information
JanZerebecki committed Jan 28, 2015
2 parents f84bd46 + c956525 commit d92a99f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.2.x-dev"
"dev-master": "1.3.x-dev"
}
}
}
7 changes: 4 additions & 3 deletions src/Deserializers/EntityDeserializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}
Expand All @@ -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'] ) );
}
Expand Down Expand Up @@ -165,4 +165,5 @@ private function setClaimsFromSerialization( array $serialization, Entity $entit
$statements = new StatementList( iterator_to_array( $claims ) );
$entity->setStatements( $statements );
}

}
8 changes: 4 additions & 4 deletions src/Serializers/FingerprintSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down Expand Up @@ -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 );
}

Expand All @@ -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();
}
Expand Down

0 comments on commit d92a99f

Please sign in to comment.