EventSubscriberInterface.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\EventDispatcher;
  11. /**
  12. * An EventSubscriber knows himself what events he is interested in.
  13. * If an EventSubscriber is added to an EventDispatcherInterface, the manager invokes
  14. * {@link getSubscribedEvents} and registers the subscriber as a listener for all
  15. * returned events.
  16. *
  17. * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
  18. * @author Jonathan Wage <jonwage@gmail.com>
  19. * @author Roman Borschel <roman@code-factory.org>
  20. * @author Bernhard Schussek <bschussek@gmail.com>
  21. *
  22. * @api
  23. */
  24. interface EventSubscriberInterface
  25. {
  26. /**
  27. * Returns an array of event names this subscriber wants to listen to.
  28. *
  29. * The array keys are event names and the value can be:
  30. *
  31. * * The method name to call (priority defaults to 0)
  32. * * An array composed of the method name to call and the priority
  33. * * An array of arrays composed of the method names to call and respective
  34. * priorities, or 0 if unset
  35. *
  36. * For instance:
  37. *
  38. * * array('eventName' => 'methodName')
  39. * * array('eventName' => array('methodName', $priority))
  40. * * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
  41. *
  42. * @return array The event names to listen to
  43. *
  44. * @api
  45. */
  46. public static function getSubscribedEvents();
  47. }