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

Commit

Permalink
Merge branch 'cache_internals' of https://github.com/marc-mabe/zf2 in…
Browse files Browse the repository at this point in the history
…to hotfix/cache-internals
  • Loading branch information
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 76 deletions.
40 changes: 20 additions & 20 deletions src/Writer/AbstractFeed.php
Expand Up @@ -41,15 +41,15 @@ class AbstractFeed
* @var array
*/
protected $_data = array();

/**
* Holds the value "atom" or "rss" depending on the feed type set when
* when last exported.
*
* @var string
*/
protected $_type = null;

/**
* Constructor: Primarily triggers the registration of core extensions and
* loads those appropriate to this data container.
Expand Down Expand Up @@ -260,15 +260,15 @@ public function setGenerator($name, $version = null, $uri = null)
*/
public function setId($id)
{
if ((empty($id) || !is_string($id) || !Uri\UriFactory::factory($id)->isValid())
if ((empty($id) || !is_string($id) || !Uri\UriFactory::factory($id)->isValid())
&& !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id)
&& !$this->_validateTagUri($id)
) {
throw new Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI');
}
$this->_data['id'] = $id;
}

/**
* Validate a URI using the tag scheme (RFC 4151)
*
Expand All @@ -277,7 +277,7 @@ public function setId($id)
*/
protected function _validateTagUri($id)
{
if (preg_match('/^tag:(?<name>.*),(?<date>\d{4}-?\d{0,2}-?\d{0,2}):(?<specific>.*)(.*:)*$/', $id, $matches)) {
if (preg_match('/^tag:(?P<name>.*),(?P<date>\d{4}-?\d{0,2}-?\d{0,2}):(?P<specific>.*)(.*:)*$/', $id, $matches)) {
$dvalid = false;
$nvalid = false;
$date = $matches['date'];
Expand Down Expand Up @@ -317,7 +317,7 @@ public function setImage(array $data)
throw new Exception('Invalid parameter: parameter \'uri\''
. ' must be a non-empty string and valid URI/IRI');
}
$this->_data['image'] = $data;
$this->_data['image'] = $data;
}

/**
Expand Down Expand Up @@ -387,7 +387,7 @@ public function setEncoding($encoding)
}
$this->_data['encoding'] = $encoding;
}

/**
* Set the feed's base URL
*
Expand All @@ -401,7 +401,7 @@ public function setBaseUrl($url)
}
$this->_data['baseUrl'] = $url;
}

/**
* Add a Pubsubhubbub hub endpoint URL
*
Expand All @@ -418,7 +418,7 @@ public function addHub($url)
}
$this->_data['hubs'][] = $url;
}

/**
* Add Pubsubhubbub hub endpoint URLs
*
Expand All @@ -430,12 +430,12 @@ public function addHubs(array $urls)
$this->addHub($url);
}
}

/**
* Add a feed category
*
* @param string $category
*/
*/
public function addCategory(array $category)
{
if (!isset($category['term'])) {
Expand All @@ -444,7 +444,7 @@ public function addCategory(array $category)
. ' readable category name');
}
if (isset($category['scheme'])) {
if (empty($category['scheme'])
if (empty($category['scheme'])
|| !is_string($category['scheme'])
|| !Uri\UriFactory::factory($category['scheme'])->isValid()
) {
Expand All @@ -457,7 +457,7 @@ public function addCategory(array $category)
}
$this->_data['categories'][] = $category;
}

/**
* Set an array of feed categories
*
Expand Down Expand Up @@ -666,7 +666,7 @@ public function getEncoding()
}
return $this->_data['encoding'];
}

/**
* Get the feed's base url
*
Expand All @@ -679,7 +679,7 @@ public function getBaseUrl()
}
return $this->_data['baseUrl'];
}

/**
* Get the URLs used as Pubsubhubbub hubs endpoints
*
Expand All @@ -692,7 +692,7 @@ public function getHubs()
}
return $this->_data['hubs'];
}

/**
* Get the feed categories
*
Expand All @@ -715,7 +715,7 @@ public function reset()
{
$this->_data = array();
}

/**
* Set the current feed type being exported to "rss" or "atom". This allows
* other objects to gracefully choose whether to execute or not, depending
Expand All @@ -727,7 +727,7 @@ public function setType($type)
{
$this->_type = $type;
}

/**
* Retrieve the current or last feed type exported.
*
Expand All @@ -737,7 +737,7 @@ public function getType()
{
return $this->_type;
}

/**
* Unset a specific data point
*
Expand All @@ -749,7 +749,7 @@ public function remove($name)
unset($this->_data[$name]);
}
}

/**
* Method overloading: call given method on first extension implementing it
*
Expand Down

0 comments on commit 81bd699

Please sign in to comment.