EventSubscriberInterface.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. interface EventSubscriberInterface
  23. {
  24. /**
  25. * Returns an array of event names this subscriber wants to listen to.
  26. *
  27. * The array keys are event names and the value can be:
  28. *
  29. * * The method name to call (priority defaults to 0)
  30. * * An array composed of the method name to call and the priority
  31. * * An array of arrays composed of the method names to call and respective
  32. * priorities, or 0 if unset
  33. *
  34. * For instance:
  35. *
  36. * * array('eventName' => 'methodName')
  37. * * array('eventName' => array('methodName', $priority))
  38. * * array('eventName' => array(array('methodName1', $priority), array('methodName2')))
  39. *
  40. * @return array The event names to listen to
  41. */
  42. public static function getSubscribedEvents();
  43. }