1<?php 2/** 3 * Zend Framework (http://framework.zend.com/) 4 * 5 * @link http://github.com/zendframework/zf2 for the canonical source repository 6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 7 * @license http://framework.zend.com/license/new-bsd New BSD License 8 */ 9 10namespace Zend\EventManager; 11 12/** 13 * Interface for self-registering event listeners. 14 * 15 * Classes implementing this interface may be registered by name or instance 16 * with a SharedEventManager, without an event name. The {@link attach()} method will 17 * then be called with the current SharedEventManager instance, allowing the class to 18 * wire up one or more listeners. 19 */ 20interface SharedListenerAggregateInterface 21{ 22 /** 23 * Attach one or more listeners 24 * 25 * Implementors may add an optional $priority argument; the SharedEventManager 26 * implementation will pass this to the aggregate. 27 * 28 * @param SharedEventManagerInterface $events 29 */ 30 public function attachShared(SharedEventManagerInterface $events); 31 32 /** 33 * Detach all previously attached listeners 34 * 35 * @param SharedEventManagerInterface $events 36 */ 37 public function detachShared(SharedEventManagerInterface $events); 38} 39