Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Response.php
Go to the documentation of this file.
1 <?php
7 
12 {
22  protected $code = 0;
23 
27  const SUCCESS = 0;
28 
32  const ERROR = 255;
33 
39  private $body;
40 
46  protected $terminateOnSend = true;
47 
53  public function sendResponse()
54  {
55  if (!empty($this->body)) {
56  echo $this->body;
57  }
58  if ($this->terminateOnSend) {
59  exit($this->code);
60  }
61  return $this->code;
62  }
63 
69  public function getBody()
70  {
71  return $this->body;
72  }
73 
80  public function setBody($body)
81  {
82  $this->body = $body;
83  }
84 
91  public function setCode($code)
92  {
93  if ($code > 255) {
94  $code = 255;
95  }
96  $this->code = $code;
97  }
98 
105  public function terminateOnSend($terminate)
106  {
107  $this->terminateOnSend = $terminate;
108  }
109 }
exit
Definition: redirect.phtml:12