Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
/*
4
 * This file is part of the Symfony package.
5
 *
6
 * (c) Fabien Potencier <fabien@symfony.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
 
12
namespace Symfony\Component\EventDispatcher;
13
 
14
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as ContractsEventDispatcherInterface;
15
 
16
/**
17
 * The EventDispatcherInterface is the central point of Symfony's event listener system.
18
 * Listeners are registered on the manager and events are dispatched through the
19
 * manager.
20
 *
21
 * @author Bernhard Schussek <bschussek@gmail.com>
22
 */
23
interface EventDispatcherInterface extends ContractsEventDispatcherInterface
24
{
25
    /**
26
     * Adds an event listener that listens on the specified events.
27
     *
28
     * @param int $priority The higher this value, the earlier an event
29
     *                      listener will be triggered in the chain (defaults to 0)
30
     */
31
    public function addListener(string $eventName, callable $listener, int $priority = 0);
32
 
33
    /**
34
     * Adds an event subscriber.
35
     *
36
     * The subscriber is asked for all the events it is
37
     * interested in and added as a listener for these events.
38
     */
39
    public function addSubscriber(EventSubscriberInterface $subscriber);
40
 
41
    /**
42
     * Removes an event listener from the specified events.
43
     */
44
    public function removeListener(string $eventName, callable $listener);
45
 
46
    public function removeSubscriber(EventSubscriberInterface $subscriber);
47
 
48
    /**
49
     * Gets the listeners of a specific event or all listeners sorted by descending priority.
50
     *
51
     * @return array<callable[]|callable>
52
     */
53
    public function getListeners(string $eventName = null): array;
54
 
55
    /**
56
     * Gets the listener priority for a specific event.
57
     *
58
     * Returns null if the event or the listener does not exist.
59
     */
60
    public function getListenerPriority(string $eventName, callable $listener): ?int;
61
 
62
    /**
63
     * Checks whether an event has any registered listeners.
64
     */
65
    public function hasListeners(string $eventName = null): bool;
66
}