diff --git a/src/Strategy/FeedStrategy.php b/src/Strategy/FeedStrategy.php index 57545f06..9072d4c7 100644 --- a/src/Strategy/FeedStrategy.php +++ b/src/Strategy/FeedStrategy.php @@ -9,21 +9,16 @@ namespace Zend\View\Strategy; +use Zend\EventManager\AbstractListenerAggregate; use Zend\EventManager\EventManagerInterface; -use Zend\EventManager\ListenerAggregateInterface; use Zend\Feed\Writer\Feed; use Zend\Http\Request as HttpRequest; use Zend\View\Model; use Zend\View\Renderer\FeedRenderer; use Zend\View\ViewEvent; -class FeedStrategy implements ListenerAggregateInterface +class FeedStrategy extends AbstractListenerAggregate { - /** - * @var \Zend\Stdlib\CallbackHandler[] - */ - protected $listeners = array(); - /** * @var FeedRenderer */ @@ -40,11 +35,7 @@ public function __construct(FeedRenderer $renderer) } /** - * Attach the aggregate to the specified event manager - * - * @param EventManagerInterface $events - * @param int $priority - * @return void + * {@inheritDoc} */ public function attach(EventManagerInterface $events, $priority = 1) { @@ -52,21 +43,6 @@ public function attach(EventManagerInterface $events, $priority = 1) $this->listeners[] = $events->attach(ViewEvent::EVENT_RESPONSE, array($this, 'injectResponse'), $priority); } - /** - * Detach aggregate listeners from the specified event manager - * - * @param EventManagerInterface $events - * @return void - */ - public function detach(EventManagerInterface $events) - { - foreach ($this->listeners as $index => $listener) { - if ($events->detach($listener)) { - unset($this->listeners[$index]); - } - } - } - /** * Detect if we should use the FeedRenderer based on model type and/or * Accept header diff --git a/src/Strategy/JsonStrategy.php b/src/Strategy/JsonStrategy.php index 4a2be49d..49d7860a 100644 --- a/src/Strategy/JsonStrategy.php +++ b/src/Strategy/JsonStrategy.php @@ -9,14 +9,14 @@ namespace Zend\View\Strategy; +use Zend\EventManager\AbstractListenerAggregate; use Zend\EventManager\EventManagerInterface; -use Zend\EventManager\ListenerAggregateInterface; use Zend\Http\Request as HttpRequest; use Zend\View\Model; use Zend\View\Renderer\JsonRenderer; use Zend\View\ViewEvent; -class JsonStrategy implements ListenerAggregateInterface +class JsonStrategy extends AbstractListenerAggregate { /** * Character set for associated content-type @@ -25,11 +25,6 @@ class JsonStrategy implements ListenerAggregateInterface */ protected $charset = 'utf-8'; - /** - * @var \Zend\Stdlib\CallbackHandler[] - */ - protected $listeners = array(); - /** * Multibyte character sets that will trigger a binary content-transfer-encoding * @@ -56,11 +51,7 @@ public function __construct(JsonRenderer $renderer) } /** - * Attach the aggregate to the specified event manager - * - * @param EventManagerInterface $events - * @param int $priority - * @return void + * {@inheritDoc} */ public function attach(EventManagerInterface $events, $priority = 1) { @@ -68,21 +59,6 @@ public function attach(EventManagerInterface $events, $priority = 1) $this->listeners[] = $events->attach(ViewEvent::EVENT_RESPONSE, array($this, 'injectResponse'), $priority); } - /** - * Detach aggregate listeners from the specified event manager - * - * @param EventManagerInterface $events - * @return void - */ - public function detach(EventManagerInterface $events) - { - foreach ($this->listeners as $index => $listener) { - if ($events->detach($listener)) { - unset($this->listeners[$index]); - } - } - } - /** * Set the content-type character set * diff --git a/src/Strategy/PhpRendererStrategy.php b/src/Strategy/PhpRendererStrategy.php index e28396fb..2a8db5d2 100644 --- a/src/Strategy/PhpRendererStrategy.php +++ b/src/Strategy/PhpRendererStrategy.php @@ -9,18 +9,13 @@ namespace Zend\View\Strategy; +use Zend\EventManager\AbstractListenerAggregate; use Zend\EventManager\EventManagerInterface; -use Zend\EventManager\ListenerAggregateInterface; use Zend\View\Renderer\PhpRenderer; use Zend\View\ViewEvent; -class PhpRendererStrategy implements ListenerAggregateInterface +class PhpRendererStrategy extends AbstractListenerAggregate { - /** - * @var \Zend\Stdlib\CallbackHandler[] - */ - protected $listeners = array(); - /** * Placeholders that may hold content * @@ -76,11 +71,7 @@ public function getContentPlaceholders() } /** - * Attach the aggregate to the specified event manager - * - * @param EventManagerInterface $events - * @param int $priority - * @return void + * {@inheritDoc} */ public function attach(EventManagerInterface $events, $priority = 1) { @@ -88,21 +79,6 @@ public function attach(EventManagerInterface $events, $priority = 1) $this->listeners[] = $events->attach(ViewEvent::EVENT_RESPONSE, array($this, 'injectResponse'), $priority); } - /** - * Detach aggregate listeners from the specified event manager - * - * @param EventManagerInterface $events - * @return void - */ - public function detach(EventManagerInterface $events) - { - foreach ($this->listeners as $index => $listener) { - if ($events->detach($listener)) { - unset($this->listeners[$index]); - } - } - } - /** * Select the PhpRenderer; typically, this will be registered last or at * low priority.