-
-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathEventSubscriberInterface.php
More file actions
53 lines (50 loc) · 2.27 KB
/
Copy pathEventSubscriberInterface.php
File metadata and controls
53 lines (50 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\EventDispatcher;
/**
* An EventSubscriber knows itself what events it is interested in.
* If an EventSubscriber is added to an EventDispatcherInterface, the manager invokes
* {@link getSubscribedEvents} and registers the subscriber as a listener for all
* returned events.
*
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
* @author Bernhard Schussek <bschussek@gmail.com>
*/
interface EventSubscriberInterface
{
/**
* Returns an array of event names this subscriber wants to listen to.
*
* The array keys are event names and the value can be:
*
* * The method name to call (priority defaults to 0)
* * An array composed of the method name to call and the priority
* * An array with a "method" key and optional "priority", "before" and "after" ones;
* "before" and "after" only apply to subscribers registered as services
* * An array of any of the two array forms above, to register several
* listeners for the same event
*
* For instance:
*
* * ['eventName' => 'methodName']
* * ['eventName' => ['methodName', $priority]]
* * ['eventName' => ['method' => 'methodName', 'priority' => $priority]]
* * ['eventName' => [['methodName1', $priority], ['methodName2']]]
* * ['eventName' => [['method' => 'methodName1'], ['method' => 'methodName2', 'priority' => $priority]]]
*
* The code must not depend on runtime state as it will only be called at compile time.
* All logic depending on runtime state must be put into the individual methods handling the events.
*
* @return array<string, string|array{0: string, 1?: int}|array{method: string, priority?: int, before?: string|list<string>, after?: string|list<string>}|list<array{0: string, 1?: int}|array{method: string, priority?: int, before?: string|list<string>, after?: string|list<string>}>>
*/
public static function getSubscribedEvents(): array;
}