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

Commit

Permalink
Show file tree
Hide file tree
Showing 70 changed files with 894 additions and 889 deletions.
20 changes: 10 additions & 10 deletions src/PubSubHubbub/Model/Subscription.php
Expand Up @@ -23,11 +23,11 @@ class Subscription extends AbstractModel implements SubscriptionPersistenceInter
{
/**
* Common DateTime object to assist with unit testing
*
*
* @var DateTime
*/
protected $now;

/**
* Save subscription to RDMBS
*
Expand All @@ -46,7 +46,7 @@ public function setSubscription(array $data)
if ($result && (0 < count($result))) {
$data['created_time'] = $result->current()->created_time;
$now = $this->getNow();
if (array_key_exists('lease_seconds', $data)
if (array_key_exists('lease_seconds', $data)
&& $data['lease_seconds']
) {
$data['expiration_time'] = $now->add(new DateInterval('PT' . $data['lease_seconds'] . 'S'))
Expand All @@ -62,11 +62,11 @@ public function setSubscription(array $data)
$this->_db->insert($data);
return true;
}

/**
* Get subscription by ID/key
*
* @param string $key
*
* @param string $key
* @return array
* @throws PubSubHubbub\Exception\InvalidArgumentException
*/
Expand All @@ -85,8 +85,8 @@ public function getSubscription($key)

/**
* Determine if a subscription matching the key exists
*
* @param string $key
*
* @param string $key
* @return bool
* @throws PubSubHubbub\Exception\InvalidArgumentException
*/
Expand Down Expand Up @@ -123,7 +123,7 @@ public function deleteSubscription($key)

/**
* Get a new DateTime or the one injected for testing
*
*
* @return DateTime
*/
public function getNow()
Expand All @@ -136,7 +136,7 @@ public function getNow()

/**
* Set a DateTime instance for assisting with unit testing
*
*
* @param DateTime $now
* @return Subscription
*/
Expand Down
16 changes: 8 additions & 8 deletions src/PubSubHubbub/Model/SubscriptionPersistenceInterface.php
Expand Up @@ -17,37 +17,37 @@
*/
interface SubscriptionPersistenceInterface
{

/**
* Save subscription to RDMBS
*
* @param array $data The key must be stored here as a $data['id'] entry
* @return bool
*/
public function setSubscription(array $data);

/**
* Get subscription by ID/key
*
* @param string $key
*
* @param string $key
* @return array
*/
public function getSubscription($key);

/**
* Determine if a subscription matching the key exists
*
* @param string $key
*
* @param string $key
* @return bool
*/
public function hasSubscription($key);

/**
* Delete a subscription
*
* @param string $key
* @return bool
*/
public function deleteSubscription($key);

}
2 changes: 1 addition & 1 deletion src/PubSubHubbub/PubSubHubbub.php
Expand Up @@ -24,7 +24,7 @@ class PubSubHubbub
*/
const VERIFICATION_MODE_SYNC = 'sync';
const VERIFICATION_MODE_ASYNC = 'async';

/**
* Subscription States
*/
Expand Down
30 changes: 15 additions & 15 deletions src/PubSubHubbub/Subscriber.php
Expand Up @@ -108,7 +108,7 @@ class Subscriber
* @var array
*/
protected $_authentications = array();

/**
* Tells the Subscriber to append any subscription identifier to the path
* of the base Callback URL. E.g. an identifier "subkey1" would be added
Expand Down Expand Up @@ -381,12 +381,12 @@ public function getHubUrls()
$this->_hubUrls = array_unique($this->_hubUrls);
return $this->_hubUrls;
}

/**
* Add authentication credentials for a given URL
*
* @param string $url
* @param array $authentication
*
* @param string $url
* @param array $authentication
* @return Subscriber
* @throws Exception\InvalidArgumentException
*/
Expand All @@ -400,11 +400,11 @@ public function addAuthentication($url, array $authentication)
$this->_authentications[$url] = $authentication;
return $this;
}

/**
* Add authentication credentials for hub URLs
*
* @param array $authentications
*
* @param array $authentications
* @return Subscriber
*/
public function addAuthentications(array $authentications)
Expand All @@ -414,21 +414,21 @@ public function addAuthentications(array $authentications)
}
return $this;
}

/**
* Get all hub URL authentication credentials
*
*
* @return array
*/
public function getAuthentications()
{
return $this->_authentications;
}

/**
* Set flag indicating whether or not to use a path parameter
*
* @param bool $bool
*
* @param bool $bool
* @return Subscriber
*/
public function usePathParameter($bool = true)
Expand Down Expand Up @@ -524,7 +524,7 @@ public function setStorage(Model\SubscriptionPersistenceInterface $storage)
}

/**
* Gets an instance of Zend\Feed\Pubsubhubbub\Storage\StoragePersistence used
* Gets an instance of Zend\Feed\Pubsubhubbub\Storage\StoragePersistence used
* to background save any verification tokens associated with a subscription
* or other.
*
Expand Down Expand Up @@ -727,7 +727,7 @@ protected function _getRequestParameters($hubUrl, $mode)
foreach ($optParams as $name => $value) {
$params[$name] = $value;
}

// store subscription to storage
$now = new DateTime();
$expires = null;
Expand Down
10 changes: 5 additions & 5 deletions src/PubSubHubbub/Subscriber/Callback.php
Expand Up @@ -25,7 +25,7 @@ class Callback extends PubSubHubbub\AbstractCallback
* @var string
*/
protected $_feedUpdate = null;

/**
* Holds a manually set subscription key (i.e. identifies a unique
* subscription) which is typical when it is not passed in the query string
Expand All @@ -35,14 +35,14 @@ class Callback extends PubSubHubbub\AbstractCallback
* @var string
*/
protected $_subscriptionKey = null;

/**
* After verification, this is set to the verified subscription's data.
*
* @var array
*/
protected $_currentSubscriptionData = null;

/**
* Set a subscription key to use for the current callback request manually.
* Required if usePathParameter is enabled for the Subscriber.
Expand Down Expand Up @@ -129,9 +129,9 @@ public function isValidHubVerification(array $httpGetData)
return false;
}
$required = array(
'hub_mode',
'hub_mode',
'hub_topic',
'hub_challenge',
'hub_challenge',
'hub_verify_token',
);
foreach ($required as $key) {
Expand Down
2 changes: 1 addition & 1 deletion src/Reader/Collection.php
Expand Up @@ -17,6 +17,6 @@
class Collection extends \ArrayObject
{



}
3 changes: 2 additions & 1 deletion src/Reader/Collection/Author.php
Expand Up @@ -23,7 +23,8 @@ class Author extends AbstractCollection
*
* @return array
*/
public function getValues() {
public function getValues()
{
$authors = array();
foreach ($this->getIterator() as $element) {
$authors[] = $element['name'];
Expand Down
3 changes: 2 additions & 1 deletion src/Reader/Collection/Category.php
Expand Up @@ -25,7 +25,8 @@ class Category extends AbstractCollection
*
* @return array
*/
public function getValues() {
public function getValues()
{
$categories = array();
foreach ($this->getIterator() as $element) {
if (isset($element['label']) && !empty($element['label'])) {
Expand Down
2 changes: 1 addition & 1 deletion src/Reader/Collection/Collection.php
Expand Up @@ -17,6 +17,6 @@
class Collection extends \ArrayObject
{



}
4 changes: 2 additions & 2 deletions src/Reader/Entry/AbstractEntry.php
Expand Up @@ -79,10 +79,10 @@ public function __construct(DOMElement $entry, $entryKey, $type = null)
$this->_domDocument = $entry->ownerDocument;
if ($type !== null) {
$this->_data['type'] = $type;
} else if ($this->_domDocument !== null) {
} elseif ($this->_domDocument !== null) {
$this->_data['type'] = Reader\Reader::detectType($this->_domDocument);
} else {
$this->_data['type'] = Reader\Reader::TYPE_ANY;
$this->_data['type'] = Reader\Reader::TYPE_ANY;
}
$this->_loadExtensions();
}
Expand Down
10 changes: 5 additions & 5 deletions src/Reader/Entry/Atom.php
Expand Up @@ -47,7 +47,7 @@ public function __construct(DOMElement $entry, $entryKey, $type = null)

$threadClass = Reader\Reader::getPluginLoader()->getClassName('Thread\\Entry');
$this->_extensions['Thread\\Entry'] = new $threadClass($entry, $entryKey, $type);

$threadClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\\Entry');
$this->_extensions['DublinCore\\Entry'] = new $threadClass($entry, $entryKey, $type);
}
Expand Down Expand Up @@ -317,7 +317,7 @@ public function getCommentFeedLink()

return $this->_data['commentfeedlink'];
}

/**
* Get category data as a Reader\Reader_Collection_Category object
*
Expand All @@ -330,7 +330,7 @@ public function getCategories()
}

$categoryCollection = $this->getExtension('Atom')->getCategories();

if (count($categoryCollection) == 0) {
$categoryCollection = $this->getExtension('DublinCore')->getCategories();
}
Expand All @@ -339,7 +339,7 @@ public function getCategories()

return $this->_data['categories'];
}

/**
* Get source feed metadata from the entry
*
Expand All @@ -355,7 +355,7 @@ public function getSource()

$this->_data['source'] = $source;

return $this->_data['source'];
return $this->_data['source'];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Reader/Entry/EntryInterface.php
Expand Up @@ -124,7 +124,7 @@ public function getCommentLink();
* @return string
*/
public function getCommentFeedLink();

/**
* Get all categories
*
Expand Down
10 changes: 5 additions & 5 deletions src/Reader/Entry/Rss.php
Expand Up @@ -99,7 +99,7 @@ public function getAuthors()
if (array_key_exists('authors', $this->_data)) {
return $this->_data['authors'];
}

$authors = array();
$authors_dc = $this->getExtension('DublinCore')->getAuthors();
if (!empty($authors_dc)) {
Expand All @@ -109,7 +109,7 @@ public function getAuthors()
);
}
}

if ($this->getType() !== Reader\Reader::TYPE_RSS_10
&& $this->getType() !== Reader\Reader::TYPE_RSS_090) {
$list = $this->_xpath->query($this->_xpathQueryRss . '//author');
Expand All @@ -129,7 +129,7 @@ public function getAuthors()
$data['name'] = $matches[1];
}
$authors[] = $data;
}
}
}
}

Expand Down Expand Up @@ -410,7 +410,7 @@ public function getLinks()

return $this->_data['links'];
}

/**
* Get all categories
*
Expand Down Expand Up @@ -441,7 +441,7 @@ public function getCategories()
} else {
$categoryCollection = $this->getExtension('DublinCore')->getCategories();
}

if (count($categoryCollection) == 0) {
$categoryCollection = $this->getExtension('Atom')->getCategories();
}
Expand Down

0 comments on commit 3a6b7ad

Please sign in to comment.