Skip to content

Commit

Permalink
Fixed mf2 language parsing in accordance w/ microformats/php-mf2#96
Browse files Browse the repository at this point in the history
  • Loading branch information
jkphl committed Dec 25, 2018
1 parent c0ca3bc commit 95e4457
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ All Notable changes to *jkphl/micrometa* will be documented in this file.

Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## [3.0.0] - Dendency update release 2018-12-15
## [3.0.0] - Dendency update release 2018-12-25

### Changed

* Updated dependency versions ([#30](https://github.com/jkphl/micrometa/pull/30), [#31](https://github.com/jkphl/micrometa/pull/31))
* Bumped PHP version requirement to 7.1

### Fixed

* Microformats language parsing in accordance with [microformats/php-mf2#96](https://github.com/microformats/php-mf2/issues/96)

### [2.1.1] - Bugfix release 2018-12-15

### Fixed
Expand Down
8 changes: 4 additions & 4 deletions src/Micrometa/Infrastructure/Factory/MicroformatsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ protected static function createProperties(array $properties, &$lang)
protected static function createLanguage(array $values, &$lang)
{
// If this is an alternate values list
if (isset($values['html-lang'])) {
if (is_string($values['html-lang'])) {
$lang = trim($values['html-lang']) ?: null;
if (isset($values['lang'])) {
if (is_string($values['lang'])) {
$lang = trim($values['lang']) ?: null;
}
unset($values['html-lang']);
unset($values['lang']);
}

return $values;
Expand Down
1 change: 0 additions & 1 deletion src/Micrometa/Tests/Infrastructure/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ public function testMicroformatsParser()
$this->assertEquals(1, count($items));
$this->assertInstanceOf(Item::class, $items[0]);
$this->assertEquals(Microformats::FORMAT, $items[0]->getFormat());
$this->assertNull($items[0]->getLanguage());
}

/**
Expand Down

0 comments on commit 95e4457

Please sign in to comment.