Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Merging develop to master in preparation for 2.12.0 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
weierophinney committed Mar 5, 2019
2 parents 8e0eaf6 + 27e9b75 commit d926c5a
Show file tree
Hide file tree
Showing 16 changed files with 143 additions and 6 deletions.
30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 2.12.0 - 2019-03-05

### Added

- [#96](https://github.com/zendframework/zend-feed/pull/96) adds the methods `Zend\Feed\Reader\Extension\Podcast\Entry::getTitle() : string`
and `Zend\Feed\Writer\Extension\ITunes\Entry::setTitle(string $value)`; these
provide the ability to read and manipulate `<itunes:title>` tags in feeds.

### Changed

- Nothing.

### Deprecated

- [#101](https://github.com/zendframework/zend-feed/pull/101) deprecates the method `Zend\Feed\Writer\Writer::lcfirst()`; use the PHP
built-in function instead.

- [#97](https://github.com/zendframework/zend-feed/pull/97) deprecates the classes `Zend\Feed\Reader\AbstractEntry` (use
`Zend\Feed\Reader\Entry\AbstractEntry` instead), `Zend\Feed\Reader\AbstractFeed` (use `Zend\Feed\Reader\Feed\AbstractFeed` instead), and
`Zend\Feed\Reader\Collection` (use Zend\Feed\Reader\Collection\Author`, `Zend\Feed\Reader\Collection\Category`, or
`Zend\Feed\Reader\Collection\Collection` instead, based on context).

### Removed

- Nothing.

### Fixed

- Nothing.

## 2.11.1 - 2019-03-05

### Added
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.11.x-dev",
"dev-develop": "2.12.x-dev"
"dev-master": "2.12.x-dev",
"dev-develop": "2.13.x-dev"
}
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/Reader/AbstractEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use DOMElement;
use DOMXPath;

/**
* @deprecated This (abstract) class is deprecated. Use Zend\Feed\Reader\Entry\AbstractEntry instead.
*/
abstract class AbstractEntry
{
/**
Expand Down
3 changes: 3 additions & 0 deletions src/Reader/AbstractFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use DOMElement;
use DOMXPath;

/**
* @deprecated This (abstract) class is deprecated. Use \Zend\Feed\Reader\Feed\AbstractFeed instead.
*/
abstract class AbstractFeed implements Feed\FeedInterface
{
/**
Expand Down
7 changes: 6 additions & 1 deletion src/Reader/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2019 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace Zend\Feed\Reader;

use ArrayObject;

/**
* @deprecated This class is deprecated. Use the concrete collection classes
* \Zend\Feed\Reader\Collection\Author and \Zend\Feed\Reader\Collection\Category
* or the generic class \Zend\Feed\Reader\Collection\Collection instead.
*/
class Collection extends ArrayObject
{
}
22 changes: 22 additions & 0 deletions src/Reader/Extension/Podcast/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,28 @@ public function getKeywords()
return $this->data['keywords'];
}

/**
* Get the entry title
*
* @return string
*/
public function getTitle()
{
if (isset($this->data['title'])) {
return $this->data['title'];
}

$title = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:title)');

if (! $title) {
$title = null;
}

$this->data['title'] = $title;

return $this->data['title'];
}

/**
* Get the entry subtitle
*
Expand Down
17 changes: 17 additions & 0 deletions src/Writer/Extension/ITunes/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,23 @@ public function setItunesKeywords(array $value)
return $this;
}

/**
* Set title
*
* @param string $value
* @return Entry
* @throws Writer\Exception\InvalidArgumentException
*/
public function setItunesTitle($value)
{
if ($this->stringWrapper->strlen($value) > 255) {
throw new Writer\Exception\InvalidArgumentException('invalid parameter: "title" may only'
. ' contain a maximum of 255 characters');
}
$this->data['title'] = $value;
return $this;
}

/**
* Set subtitle
*
Expand Down
23 changes: 23 additions & 0 deletions src/Writer/Extension/ITunes/Renderer/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function render()
$this->_setImage($this->dom, $this->base);
$this->_setExplicit($this->dom, $this->base);
$this->_setKeywords($this->dom, $this->base);
$this->_setTitle($this->dom, $this->base);
$this->_setSubtitle($this->dom, $this->base);
$this->_setSummary($this->dom, $this->base);
$this->_setEpisode($this->dom, $this->base);
Expand Down Expand Up @@ -198,6 +199,28 @@ protected function _setKeywords(DOMDocument $dom, DOMElement $root)
$this->called = true;
}

/**
* Set entry title
*
* @param DOMDocument $dom
* @param DOMElement $root
* @return void
*/
// @codingStandardsIgnoreStart
protected function _setTitle(DOMDocument $dom, DOMElement $root)
{
// @codingStandardsIgnoreEnd
$title = $this->getDataContainer()->getItunesTitle();
if (! $title) {
return;
}
$el = $dom->createElement('itunes:title');
$text = $dom->createTextNode($title);
$el->appendChild($text);
$root->appendChild($el);
$this->called = true;
}

/**
* Set entry subtitle
*
Expand Down
9 changes: 7 additions & 2 deletions src/Writer/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,15 @@ public static function registerCoreExtensions()
);
}

/**
* @deprecated This method is deprecated and will be removed with version 3.0
* Use PHP's lcfirst function instead. @see https://php.net/manual/function.lcfirst.php
* @param string $str
* @return string
*/
public static function lcfirst($str)
{
$str[0] = strtolower($str[0]);
return $str;
return lcfirst($str);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions test/Reader/Integration/_files/google-podcast-complete.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<googleplay:explicit>no</googleplay:explicit>
<itunes:author>John Doe</itunes:author>
<googleplay:block>yes</googleplay:block>
<itunes:title>Shake Shake Shake Your Spices With A Shaker</itunes:title>
<itunes:subtitle>A short primer on table spices
</itunes:subtitle>
<googleplay:description>This week we talk about salt and pepper
Expand All @@ -59,6 +60,7 @@
<item>
<title>Socket Wrench Shootout</title>
<itunes:author>Jane Doe</itunes:author>
<itunes:title>Socket Wrench Shootout With A Tool</itunes:title>
<itunes:subtitle>Comparing socket wrenches is fun!
</itunes:subtitle>
<googleplay:description>This week we talk about metric vs. old
Expand All @@ -78,6 +80,7 @@
<item>
<title>Red, Whine, &amp; Blue</title>
<itunes:author>Various</itunes:author>
<itunes:title>Red, Whine &amp; Blue</itunes:title>
<itunes:subtitle>Red + Blue != Purple</itunes:subtitle>
<googleplay:description>This week we talk about surviving in a Red
state if you are a Blue person. Or vice versa.
Expand Down
3 changes: 3 additions & 0 deletions test/Reader/Integration/_files/google-podcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<googleplay:explicit>no</googleplay:explicit>
<itunes:author>John Doe</itunes:author>
<googleplay:block>yes</googleplay:block>
<itunes:title>Shake Shake Shake Your Spices With A Shaker</itunes:title>
<itunes:subtitle>A short primer on table spices
</itunes:subtitle>
<googleplay:description>This week we talk about salt and pepper
Expand All @@ -60,6 +61,7 @@
<item>
<title>Socket Wrench Shootout</title>
<itunes:author>Jane Doe</itunes:author>
<itunes:title>Socket Wrench Shootout With A Tool</itunes:title>
<itunes:subtitle>Comparing socket wrenches is fun!
</itunes:subtitle>
<googleplay:description>This week we talk about metric vs. old
Expand All @@ -81,6 +83,7 @@
<item>
<title>Red, Whine, &amp; Blue</title>
<itunes:author>Various</itunes:author>
<itunes:title>Red, Whine &amp; Blue</itunes:title>
<itunes:subtitle>Red + Blue != Purple</itunes:subtitle>
<googleplay:description>This week we talk about surviving in a Red
state if you are a Blue person. Or vice versa.
Expand Down
3 changes: 3 additions & 0 deletions test/Reader/Integration/_files/podcast-complete.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<itunes:explicit>no</itunes:explicit>
<itunes:author>John Doe</itunes:author>
<itunes:block>yes</itunes:block>
<itunes:title>Shake Shake Shake Your Spices With A Shaker</itunes:title>
<itunes:subtitle>A short primer on table spices
</itunes:subtitle>
<itunes:summary>This week we talk about salt and pepper
Expand All @@ -57,6 +58,7 @@
<item>
<title>Socket Wrench Shootout</title>
<itunes:author>Jane Doe</itunes:author>
<itunes:title>Socket Wrench Shootout With A Tool</itunes:title>
<itunes:subtitle>Comparing socket wrenches is fun!
</itunes:subtitle>
<itunes:summary>This week we talk about metric vs. old
Expand All @@ -76,6 +78,7 @@
<item>
<title>Red, Whine, &amp; Blue</title>
<itunes:author>Various</itunes:author>
<itunes:title>Red, Whine &amp; Blue</itunes:title>
<itunes:subtitle>Red + Blue != Purple</itunes:subtitle>
<itunes:summary>This week we talk about surviving in a Red
state if you are a Blue person. Or vice versa.
Expand Down
3 changes: 3 additions & 0 deletions test/Reader/Integration/_files/podcast-episode.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<itunes:explicit>no</itunes:explicit>
<itunes:author>John Doe</itunes:author>
<itunes:block>yes</itunes:block>
<itunes:title>Shake Shake Shake Your Spices With A Shaker</itunes:title>
<itunes:subtitle>A short primer on table spices
</itunes:subtitle>
<itunes:summary>This week we talk about salt and pepper
Expand All @@ -58,6 +59,7 @@
<item>
<title>Socket Wrench Shootout</title>
<itunes:author>Jane Doe</itunes:author>
<itunes:title>Socket Wrench Shootout With A Tool</itunes:title>
<itunes:subtitle>Comparing socket wrenches is fun!
</itunes:subtitle>
<itunes:summary>This week we talk about metric vs. old
Expand All @@ -77,6 +79,7 @@
<item>
<title>Red, Whine, &amp; Blue</title>
<itunes:author>Various</itunes:author>
<itunes:title>Red, Whine &amp; Blue</itunes:title>
<itunes:subtitle>Red + Blue != Purple</itunes:subtitle>
<itunes:summary>This week we talk about surviving in a Red
state if you are a Blue person. Or vice versa.
Expand Down
3 changes: 3 additions & 0 deletions test/Reader/Integration/_files/podcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<itunes:explicit>no</itunes:explicit>
<itunes:author>John Doe</itunes:author>
<itunes:block>yes</itunes:block>
<itunes:title>Shake Shake Shake Your Spices With A Shaker</itunes:title>
<itunes:subtitle>A short primer on table spices
</itunes:subtitle>
<itunes:summary>This week we talk about salt and pepper
Expand All @@ -58,6 +59,7 @@
<item>
<title>Socket Wrench Shootout</title>
<itunes:author>Jane Doe</itunes:author>
<itunes:title>Socket Wrench Shootout With A Tool</itunes:title>
<itunes:subtitle>Comparing socket wrenches is fun!
</itunes:subtitle>
<itunes:summary>This week we talk about metric vs. old
Expand All @@ -79,6 +81,7 @@
<item>
<title>Red, Whine, &amp; Blue</title>
<itunes:author>Various</itunes:author>
<itunes:title>Red, Whine &amp; Blue</itunes:title>
<itunes:subtitle>Red + Blue != Purple</itunes:subtitle>
<itunes:summary>This week we talk about surviving in a Red
state if you are a Blue person. Or vice versa.
Expand Down
14 changes: 14 additions & 0 deletions test/Writer/Extension/ITunes/EntryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,20 @@ public function testSetKeywordsThrowsExceptionIfFormattedKeywordsExceeds255CharL
}
}

public function testSetTitle()
{
$entry = new Writer\Entry;
$entry->setItunesTitle('abc');
$this->assertEquals('abc', $entry->getItunesTitle());
}

public function testSetTitleThrowsExceptionWhenValueExceeds255Chars()
{
$this->expectException(ExceptionInterface::class);
$entry = new Writer\Entry;
$entry->setItunesTitle(str_repeat('a', 256));
}

public function testSetSubtitle()
{
$entry = new Writer\Entry;
Expand Down

0 comments on commit d926c5a

Please sign in to comment.