public function status($code = null) {
        if ($code === null) {
            return $this->status;
        }

        if (array_key_exists($code, self::$codes)) {
            $this->status = $code;
        }
        else {
            throw new \Exception('Invalid status code.');
        }

        return $this;
    }
public function status($code = null) {
        if ($code === null) {
            return $this->status;
        }

        if (array_key_exists($code, self::$codes)) {
            $this->status = $code;
        }
        else {
            throw new \Exception('Invalid status code.');
        }

        return $this;
    }
public function status ( $ code = null ) { if ( $ code === null ) { return $ this -> status ; } if ( array_key_exists ( $ code , self :: $ codes ) ) { $ this -> status = $ code ; } else { throw new \ Exception ( 'Invalid status code.' ) ; } return $ this ; }
Sets the HTTP status of the response.

@param int $code HTTP status code.
@return object|int Self reference
@throws \Exception If invalid status code
Sets the HTTP status of the response .