ResultInterface.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Controller;
  7. use Magento\Framework\App\ResponseInterface;
  8. /**
  9. * An abstraction of result that controller actions must return
  10. * The point of this kind of object is to encapsulate all information/objects relevant to the result
  11. * and be able to set it to the HTTP response
  12. *
  13. * @api
  14. * @since 100.0.2
  15. */
  16. interface ResultInterface
  17. {
  18. /**
  19. * @param int $httpCode
  20. * @return $this
  21. */
  22. public function setHttpResponseCode($httpCode);
  23. /**
  24. * Set a header
  25. *
  26. * If $replace is true, replaces any headers already defined with that
  27. * $name.
  28. *
  29. * @param string $name
  30. * @param string $value
  31. * @param boolean $replace
  32. * @return $this
  33. */
  34. public function setHeader($name, $value, $replace = false);
  35. /**
  36. * Render result and set to response
  37. *
  38. * @param ResponseInterface $response
  39. * @return $this
  40. */
  41. public function renderResult(ResponseInterface $response);
  42. }