EventSubscriberInterface.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /*
  3. * This file is part of Composer.
  4. *
  5. * (c) Nils Adermann <naderman@naderman.de>
  6. * Jordi Boggiano <j.boggiano@seld.be>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace Composer\EventDispatcher;
  12. /**
  13. * An EventSubscriber knows which events it is interested in.
  14. *
  15. * If an EventSubscriber is added to an EventDispatcher, the manager invokes
  16. * {@link getSubscribedEvents} and registers the subscriber as a listener for all
  17. * returned events.
  18. *
  19. * @author Guilherme Blanco <guilhermeblanco@hotmail.com>
  20. * @author Jonathan Wage <jonwage@gmail.com>
  21. * @author Roman Borschel <roman@code-factory.org>
  22. * @author Bernhard Schussek <bschussek@gmail.com>
  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. public static function getSubscribedEvents();
  45. }