|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * @see https://github.com/zendframework/zend-eventmanager for the canonical source repository |
| 4 | + * @copyright Copyright (c) 2019 Zend Technologies USA Inc. (https://www.zend.com) |
| 5 | + * @license https://github.com/zendframework/zend-eventmanager/blob/master/LICENSE.md New BSD License |
| 6 | + */ |
| 7 | + |
| 8 | +namespace Zend\EventManager\ListenerProvider; |
| 9 | + |
| 10 | +interface PrioritizedListenerAttachmentInterface |
| 11 | +{ |
| 12 | + /** |
| 13 | + * @param string $event The event type to which the listener will respond. |
| 14 | + * @param callable $listener The listener itself. |
| 15 | + * @param int $priority The priority at which to attach the listener. High |
| 16 | + * priorities respond earlier; negative priorities respond later. |
| 17 | + * @return void |
| 18 | + */ |
| 19 | + public function attach($event, callable $listener, $priority = 1); |
| 20 | + |
| 21 | + /** |
| 22 | + * @param callable $listener The listener to detach. |
| 23 | + * @param null|string $event Which events to detach the listener from. |
| 24 | + * When null, all events. If '*', this will only detach the wildcard |
| 25 | + * entry for a listener, unless $force is true. |
| 26 | + * @return void |
| 27 | + */ |
| 28 | + public function detach(callable $listener, $event = null); |
| 29 | + |
| 30 | + /** |
| 31 | + * Attaches a listener as a wildcard listener (to all events). |
| 32 | + * |
| 33 | + * Analagous to: |
| 34 | + * |
| 35 | + * <code> |
| 36 | + * attach('*', $listener, $priority) |
| 37 | + * </code> |
| 38 | + * |
| 39 | + * The above will actually invoke this method instead. |
| 40 | + * |
| 41 | + * @param callable $listener The listener to attach. |
| 42 | + * @param int $priority The priority at which to attach the listener. |
| 43 | + * High priorities respond earlier; negative priorities respond later. |
| 44 | + * @return void |
| 45 | + */ |
| 46 | + public function attachWildcardListener(callable $listener, $priority = 1); |
| 47 | + |
| 48 | + /** |
| 49 | + * Detaches a wildcard listener. |
| 50 | + * |
| 51 | + * Analagous to: |
| 52 | + * |
| 53 | + * <code> |
| 54 | + * detach($listener, '*', $force) |
| 55 | + * </code> |
| 56 | + * |
| 57 | + * The above will actually invoke this method instead. |
| 58 | + * |
| 59 | + * @param callable $listener The listener to detach. |
| 60 | + * @return void |
| 61 | + */ |
| 62 | + public function detachWildcardListener(callable $listener); |
| 63 | + |
| 64 | + /** |
| 65 | + * @param string $event The event for which to remove listeners. |
| 66 | + * @return void |
| 67 | + */ |
| 68 | + public function clearListeners($event); |
| 69 | +} |
0 commit comments