Formatter.php 1012 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace Http\Message;
  3. use Psr\Http\Message\RequestInterface;
  4. use Psr\Http\Message\ResponseInterface;
  5. /**
  6. * Formats a request and/or a response as a string.
  7. *
  8. * @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
  9. *
  10. * The formatResponseForRequest method will be added to this interface in the next major version, replacing the formatRequest method.
  11. * Meanwhile, callers SHOULD check the formatter for the existence of formatResponseForRequest and call that if available.
  12. *
  13. * @method string formatResponseForRequest(ResponseInterface $response, RequestInterface $request) Formats a response in context of its request.
  14. */
  15. interface Formatter
  16. {
  17. /**
  18. * Formats a request.
  19. *
  20. * @return string
  21. */
  22. public function formatRequest(RequestInterface $request);
  23. /**
  24. * @deprecated since 1.13, use formatResponseForRequest() instead
  25. *
  26. * Formats a response.
  27. *
  28. * @return string
  29. */
  30. public function formatResponse(ResponseInterface $response);
  31. }