Drupal investigation

ControllerResolverInterface.php 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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\HttpKernel\Controller;
  11. use Symfony\Component\HttpFoundation\Request;
  12. /**
  13. * A ControllerResolverInterface implementation knows how to determine the
  14. * controller to execute based on a Request object.
  15. *
  16. * It can also determine the arguments to pass to the Controller.
  17. *
  18. * A Controller can be any valid PHP callable.
  19. *
  20. * @author Fabien Potencier <fabien@symfony.com>
  21. */
  22. interface ControllerResolverInterface
  23. {
  24. /**
  25. * Returns the Controller instance associated with a Request.
  26. *
  27. * As several resolvers can exist for a single application, a resolver must
  28. * return false when it is not able to determine the controller.
  29. *
  30. * The resolver must only throw an exception when it should be able to load
  31. * controller but cannot because of some errors made by the developer.
  32. *
  33. * @param Request $request A Request instance
  34. *
  35. * @return callable|false A PHP callable representing the Controller,
  36. * or false if this resolver is not able to determine the controller
  37. *
  38. * @throws \LogicException If the controller can't be found
  39. */
  40. public function getController(Request $request);
  41. /**
  42. * Returns the arguments to pass to the controller.
  43. *
  44. * @param Request $request A Request instance
  45. * @param callable $controller A PHP callable
  46. *
  47. * @return array An array of arguments to pass to the controller
  48. *
  49. * @throws \RuntimeException When value for argument given is not provided
  50. */
  51. public function getArguments(Request $request, $controller);
  52. }