public function setStatus(int $code, string $reason = null)
    {
        $this->status = $this->validateStatusCode($code);
        $this->reason = $reason ?? Status::getReason($this->status);

        if ($this->upgrade && $this->status !== Status::SWITCHING_PROTOCOLS) {
            $this->upgrade = null;
        }
    }
public function setStatus(int $code, string $reason = null)
    {
        $this->status = $this->validateStatusCode($code);
        $this->reason = $reason ?? Status::getReason($this->status);

        if ($this->upgrade && $this->status !== Status::SWITCHING_PROTOCOLS) {
            $this->upgrade = null;
        }
    }
public function setStatus ( int $ code , string $ reason = null ) { $ this -> status = $ this -> validateStatusCode ( $ code ) ; $ this -> reason = $ reason ?? Status :: getReason ( $ this -> status ) ; if ( $ this -> upgrade && $ this -> status !== Status :: SWITCHING_PROTOCOLS ) { $ this -> upgrade = null ; } }
Sets the response status code and reason phrase. Use null for the reason phrase to use the default phrase
associated with the status code.

@param int $code 100 - 599
@param string|null $reason
Sets the response status code and reason phrase . Use null for the reason phrase to use the default phrase associated with the status code .