public function setStatusCode($value, $text = null)
    {
        if ($value === null) {
            $value = 200;
        }
        $this->_statusCode = (int) $value;
        if ($this->getIsInvalid()) {
            throw new InvalidArgumentException("The HTTP status code is invalid: $value");
        }
        if ($text === null) {
            $this->statusText = isset(static::$httpStatuses[$this->_statusCode]) ? static::$httpStatuses[$this->_statusCode] : '';
        } else {
            $this->statusText = $text;
        }

        return $this;
    }
public function setStatusCode($value, $text = null)
    {
        if ($value === null) {
            $value = 200;
        }
        $this->_statusCode = (int) $value;
        if ($this->getIsInvalid()) {
            throw new InvalidArgumentException("The HTTP status code is invalid: $value");
        }
        if ($text === null) {
            $this->statusText = isset(static::$httpStatuses[$this->_statusCode]) ? static::$httpStatuses[$this->_statusCode] : '';
        } else {
            $this->statusText = $text;
        }

        return $this;
    }
public function setStatusCode ( $ value , $ text = null ) { if ( $ value === null ) { $ value = 200 ; } $ this -> _statusCode = ( int ) $ value ; if ( $ this -> getIsInvalid ( ) ) { throw new InvalidArgumentException ( "The HTTP status code is invalid: $value" ) ; } if ( $ text === null ) { $ this -> statusText = isset ( static :: $ httpStatuses [ $ this -> _statusCode ] ) ? static :: $ httpStatuses [ $ this -> _statusCode ] : '' ; } else { $ this -> statusText = $ text ; } return $ this ; }
Sets the response status code.
This method will set the corresponding status text if `$text` is null.
@param int $value the status code
@param string $text the status text. If not set, it will be set automatically based on the status code.
@throws InvalidArgumentException if the status code is invalid.
@return $this the response object itself
Sets the response status code . This method will set the corresponding status text if $text is null .