Skip to content

Commit

Permalink
Zend\Feed\PubSubHubbub cleanup
Browse files Browse the repository at this point in the history
- Renamed interfaces to remove "Interface" suffix
- Renamed "ComponentAbstract" to "AbstractComponent" throughout
- Fixed areas where names were artificially pushed down a level in the hierarchy
  • Loading branch information
weierophinney committed Jul 6, 2010
1 parent 9ef992e commit d2f5537
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace Zend\Feed\PubSubHubbub;

/**
* @uses \Zend\Feed\PubSubHubbub\CallbackInterface
* @uses \Zend\Feed\PubSubHubbub\Callback
* @uses \Zend\Feed\PubSubHubbub\Exception
* @uses \Zend\Feed\PubSubHubbub\HttpResponse
* @category Zend
Expand All @@ -35,24 +35,23 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class CallbackAbstract
implements CallbackInterface
abstract class AbstractCallback implements Callback
{
/**
* An instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used
* An instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionPersistence used
* to background save any verification tokens associated with a subscription
* or other.
*
* @var \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface
* @var \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence
*/
protected $_storage = null;

/**
* An instance of a class handling Http Responses. This is implemented in
* Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with
* (i.e. not inherited from) Zend_Controller_Response_Http.
* Zend\Feed\Pubsubhubbub\HttpResponse which shares an unenforced interface with
* (i.e. not inherited from) Zend\Controller\Response\HTTP.
*
* @var Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http
* @var Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\HTTP
*/
protected $_httpResponse = null;

Expand All @@ -64,7 +63,7 @@ abstract class CallbackAbstract
protected $_subscriberCount = 1;

/**
* Constructor; accepts an array or Zend_Config instance to preset
* Constructor; accepts an array or Zend\Config instance to preset
* options for the Subscriber without calling all supported setter
* methods in turn.
*
Expand All @@ -81,7 +80,7 @@ public function __construct($config = null)
* Process any injected configuration options
*
* @param array|\Zend\Config\Config $options Options array or \Zend\Config\Config instance
* @return \Zend\Feed\PubSubHubbub\CallbackAbstract
* @return \Zend\Feed\PubSubHubbub\AbstractCallback
*/
public function setConfig($config)
{
Expand Down Expand Up @@ -111,63 +110,63 @@ public function sendResponse()
}

/**
* Sets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used
* Sets an instance of Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence used
* to background save any verification tokens associated with a subscription
* or other.
*
* @param \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface $storage
* @return \Zend\Feed\PubSubHubbub\CallbackAbstract
* @param \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence $storage
* @return \Zend\Feed\PubSubHubbub\AbstractCallback
*/
public function setStorage(Model\SubscriptionInterface $storage)
public function setStorage(Model\SubscriptionPersistence $storage)
{
$this->_storage = $storage;
return $this;
}

/**
* Gets an instance of Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface used
* Gets an instance of Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence used
* to background save any verification tokens associated with a subscription
* or other.
*
* @return \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface
* @return \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence
*/
public function getStorage()
{
if ($this->_storage === null) {
throw new Exception('No storage object has been'
. ' set that subclasses Zend_Feed_Pubsubhubbub_Model_SubscriptionInterface');
. ' set that subclasses Zend\Feed\Pubsubhubbub\Model\SubscriptionPersistence');
}
return $this->_storage;
}

/**
* An instance of a class handling Http Responses. This is implemented in
* Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with
* (i.e. not inherited from) Zend_Controller_Response_Http.
* Zend\Feed\Pubsubhubbub\HttpResponse which shares an unenforced interface with
* (i.e. not inherited from) Zend\Controller\Response\HTTP.
*
* @param Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http $httpResponse
* @return \Zend\Feed\PubSubHubbub\CallbackAbstract
* @param Zend\Feed\Pubsubhubbub\HttpResponse|\Zend\Controller\Response\HTTP $httpResponse
* @return \Zend\Feed\PubSubHubbub\AbstractCallback
*/
public function setHttpResponse($httpResponse)
{
if (!is_object($httpResponse)
|| (!$httpResponse instanceof HttpResponse
&& !$httpResponse instanceof \Zend\Controller\Response\Http)
&& !$httpResponse instanceof \Zend\Controller\Response\HTTP)
) {
throw new Exception('HTTP Response object must'
. ' implement one of Zend_Feed_Pubsubhubbub_HttpResponse or'
. ' Zend_Controller_Response_Http');
. ' implement one of Zend\Feed\Pubsubhubbub\HttpResponse or'
. ' Zend\Controller\Response\HTTP');
}
$this->_httpResponse = $httpResponse;
return $this;
}

/**
* An instance of a class handling Http Responses. This is implemented in
* Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with
* (i.e. not inherited from) Zend_Controller_Response_Http.
* Zend\Feed\Pubsubhubbub\HttpResponse which shares an unenforced interface with
* (i.e. not inherited from) Zend\Controller\Response\HTTP.
*
* @return Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http
* @return Zend\Feed\Pubsubhubbub\HttpResponse|\Zend\Controller\Response\HTTP
*/
public function getHttpResponse()
{
Expand All @@ -183,7 +182,7 @@ public function getHttpResponse()
* Defaults to 1 if left unchanged.
*
* @param string|int $count
* @return \Zend\Feed\PubSubHubbub\CallbackAbstract
* @return \Zend\Feed\PubSubHubbub\AbstractCallback
*/
public function setSubscriberCount($count)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface CallbackInterface
interface Callback
{
/**
* Handle any callback from a Hub Server responding to a subscription or
Expand All @@ -59,7 +59,7 @@ public function sendResponse();
* Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with
* (i.e. not inherited from) Zend_Controller_Response_Http.
*
* @param Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http $httpResponse
* @param Zend\Feed\PubSubHubbub\HttpResponse|\Zend\Controller\Response\Http $httpResponse
*/
public function setHttpResponse($httpResponse);

Expand All @@ -68,7 +68,7 @@ public function setHttpResponse($httpResponse);
* Zend_Feed_Pubsubhubbub_HttpResponse which shares an unenforced interface with
* (i.e. not inherited from) Zend_Controller_Response_Http.
*
* @return Zend_Feed_Pubsubhubbub_HttpResponse|\Zend\Controller\Response\Http
* @return Zend\Feed\PubSubHubbub\HttpResponse|\Zend\Controller\Response\Http
*/
public function getHttpResponse();
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class ModelAbstract
class AbstractModel
{
/**
* Zend_Db_Table instance to host database methods
Expand Down
8 changes: 3 additions & 5 deletions library/Zend/Feed/PubSubHubbub/Model/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@
/**
* @uses \Zend\Date\Date
* @uses \Zend\Feed\PubSubHubbub\Exception
* @uses \Zend\Feed\PubSubHubbub\Model\ModelAbstract
* @uses \Zend\Feed\PubSubHubbub\Model\SubscriptionInterface
* @uses \Zend\Feed\PubSubHubbub\Model\AbstractModel
* @uses \Zend\Feed\PubSubHubbub\Model\SubscriptionPersistence
* @category Zend
* @package Zend_Feed_Pubsubhubbub
* @subpackage Entity
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Subscription
extends ModelAbstract
implements SubscriptionInterface
class Subscription extends AbstractModel implements SubscriptionPersistence
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface SubscriptionInterface
interface SubscriptionPersistence
{

/**
Expand Down
5 changes: 2 additions & 3 deletions library/Zend/Feed/PubSubHubbub/PubSubHubbub.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,14 @@ public static function detectHubs($source)
{
if (is_string($source)) {
$feed = Reader\Reader::import($source);
} elseif (is_object($source) && $source instanceof Reader\FeedAbstract) {
} elseif (is_object($source) && $source instanceof Reader\AbstractFeed) {
$feed = $source;
} elseif (is_object($source) && $source instanceof \Zend\Feed\AbstractFeed) {
$feed = Reader\Reader::importFeed($source);
} else {
require_once 'Zend/Feed/Pubsubhubbub/Exception.php';
throw new Exception('The source parameter was'
. ' invalid, i.e. not a URL string or an instance of type'
. ' Zend_Feed_Reader_FeedAbstract or Zend_Feed_Abstract');
. ' Zend\Feed\Reader\FeedAbstract or Zend\Feed\Abstract');
}
return $feed->getHubs();
}
Expand Down
Loading

0 comments on commit d2f5537

Please sign in to comment.