ControllerResolverInterface.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. * A Controller can be any valid PHP callable.
  17. *
  18. * @author Fabien Potencier <fabien@symfony.com>
  19. */
  20. interface ControllerResolverInterface
  21. {
  22. /**
  23. * Returns the Controller instance associated with a Request.
  24. *
  25. * As several resolvers can exist for a single application, a resolver must
  26. * return false when it is not able to determine the controller.
  27. *
  28. * The resolver must only throw an exception when it should be able to load a
  29. * controller but cannot because of some errors made by the developer.
  30. *
  31. * @return callable|false A PHP callable representing the Controller,
  32. * or false if this resolver is not able to determine the controller
  33. *
  34. * @throws \LogicException If a controller was found based on the request but it is not callable
  35. */
  36. public function getController(Request $request);
  37. }