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 an EventManager, without an event name. The {@link attach()} method will 17 * then be called with the current EventManager instance, allowing the class to 18 * wire up one or more listeners. 19 */ 20interface ListenerAggregateInterface 21{ 22 /** 23 * Attach one or more listeners 24 * 25 * Implementors may add an optional $priority argument; the EventManager 26 * implementation will pass this to the aggregate. 27 * 28 * @param EventManagerInterface $events 29 * 30 * @return void 31 */ 32 public function attach(EventManagerInterface $events); 33 34 /** 35 * Detach all previously attached listeners 36 * 37 * @param EventManagerInterface $events 38 * 39 * @return void 40 */ 41 public function detach(EventManagerInterface $events); 42} 43