vendor/friendsofsymfony/rest-bundle/View/ViewHandlerInterface.php line 44

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the FOSRestBundle package.
  4. *
  5. * (c) FriendsOfSymfony <http://friendsofsymfony.github.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 FOS\RestBundle\View;
  11. use Symfony\Component\HttpFoundation\Request;
  12. use Symfony\Component\HttpFoundation\Response;
  13. /**
  14. * @author Jordi Boggiano <j.boggiano@seld.be>
  15. * @author Lukas K. Smith <smith@pooteeweet.org>
  16. */
  17. interface ViewHandlerInterface
  18. {
  19. /**
  20. * @return bool
  21. */
  22. public function supports(string $format);
  23. /**
  24. * Registers a custom handler.
  25. *
  26. * The handler must have the following signature: handler($viewObject, $request, $response)
  27. * It can use the methods of this class to retrieve the needed data and return a
  28. * Response object ready to be sent.
  29. */
  30. public function registerHandler(string $format, callable $callable);
  31. /**
  32. * Handles a request with the proper handler.
  33. *
  34. * Decides on which handler to use based on the request format
  35. *
  36. * @return Response
  37. */
  38. public function handle(View $view, Request $request = null);
  39. /**
  40. * @return Response
  41. */
  42. public function createRedirectResponse(View $view, string $location, string $format);
  43. /**
  44. * @return Response
  45. */
  46. public function createResponse(View $view, Request $request, string $format);
  47. }