| 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 |
/**
|
|
|
15 |
* An EventSubscriber knows itself what events it is interested in.
|
|
|
16 |
* If an EventSubscriber is added to an EventDispatcherInterface, the manager invokes
|
|
|
17 |
* {@link getSubscribedEvents} and registers the subscriber as a listener for all
|
|
|
18 |
* returned events.
|
|
|
19 |
*
|
|
|
20 |
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
|
|
|
21 |
* @author Jonathan Wage <jonwage@gmail.com>
|
|
|
22 |
* @author Roman Borschel <roman@code-factory.org>
|
|
|
23 |
* @author Bernhard Schussek <bschussek@gmail.com>
|
|
|
24 |
*/
|
|
|
25 |
interface EventSubscriberInterface
|
|
|
26 |
{
|
|
|
27 |
/**
|
|
|
28 |
* Returns an array of event names this subscriber wants to listen to.
|
|
|
29 |
*
|
|
|
30 |
* The array keys are event names and the value can be:
|
|
|
31 |
*
|
|
|
32 |
* * The method name to call (priority defaults to 0)
|
|
|
33 |
* * An array composed of the method name to call and the priority
|
|
|
34 |
* * An array of arrays composed of the method names to call and respective
|
|
|
35 |
* priorities, or 0 if unset
|
|
|
36 |
*
|
|
|
37 |
* For instance:
|
|
|
38 |
*
|
|
|
39 |
* * ['eventName' => 'methodName']
|
|
|
40 |
* * ['eventName' => ['methodName', $priority]]
|
|
|
41 |
* * ['eventName' => [['methodName1', $priority], ['methodName2']]]
|
|
|
42 |
*
|
|
|
43 |
* The code must not depend on runtime state as it will only be called at compile time.
|
|
|
44 |
* All logic depending on runtime state must be put into the individual methods handling the events.
|
|
|
45 |
*
|
|
|
46 |
* @return array<string, string|array{0: string, 1: int}|list<array{0: string, 1?: int}>>
|
|
|
47 |
*/
|
|
|
48 |
public static function getSubscribedEvents();
|
|
|
49 |
}
|