public function setStatusCode($statusCode)
    {
        $statusCode = (int)$statusCode;
        if ($statusCode < 100 || $statusCode >= 600) {
            throw new \Exception("Invalid status code: {$statusCode}.");
        }
        $this->statusCode = $statusCode;
        return $this;
    }
public function setStatusCode($statusCode)
    {
        $statusCode = (int)$statusCode;
        if ($statusCode < 100 || $statusCode >= 600) {
            throw new \Exception("Invalid status code: {$statusCode}.");
        }
        $this->statusCode = $statusCode;
        return $this;
    }
public function setStatusCode ( $ statusCode ) { $ statusCode = ( int ) $ statusCode ; if ( $ statusCode < 100 || $ statusCode >= 600 ) { throw new \ Exception ( "Invalid status code: {$statusCode}." ) ; } $ this -> statusCode = $ statusCode ; return $ this ; }
Sets the status code.

@param int $statusCode The status code.

@throws Exception Throws an exception when an invalid status code is used.

@return $this The current object.
Sets the status code .