From 66b865cfc13ef4574875b09d610444ba716f525a Mon Sep 17 00:00:00 2001 From: Alex Debril Date: Sat, 21 Nov 2015 19:04:54 +0100 Subject: [PATCH] url support --- src/FeedIo/Feed.php | 24 ++++++++++++++++++++++++ tests/FeedIo/FeedTest.php | 10 ++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/FeedIo/Feed.php b/src/FeedIo/Feed.php index b144cd45..f776dc51 100644 --- a/src/FeedIo/Feed.php +++ b/src/FeedIo/Feed.php @@ -21,6 +21,11 @@ class Feed extends Node implements FeedInterface */ protected $items; + /** + * @var string $url + */ + protected $url; + public function __construct() { $this->items = new \ArrayIterator(); @@ -28,6 +33,25 @@ public function __construct() parent::__construct(); } + /** + * @return string $url + */ + public function getUrl() + { + return $this->url; + } + + /** + * @param string $url + * @return FeedInterface + */ + public function setUrl($url) + { + $this->url = $url; + + return $this; + } + /** * (PHP 5 >= 5.0.0)
* Return the current element diff --git a/tests/FeedIo/FeedTest.php b/tests/FeedIo/FeedTest.php index 7600149e..1314346a 100644 --- a/tests/FeedIo/FeedTest.php +++ b/tests/FeedIo/FeedTest.php @@ -88,4 +88,14 @@ public function testAdd() $this->assertAttributeEquals(new \ArrayIterator(array($item)), 'items', $this->object); $this->assertEquals($this->object->current(), $item); } + + public function testUrl() + { + $url = 'http://localhost'; + + $feed = new Feed; + $feed->setUrl($url); + + $this->assertEquals($url, $feed->getUrl()); + } }