protected function setStatus($code, $reasonPhrase = '')
    {
        if (! is_string($reasonPhrase)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid reason phrase provided; must be a string, "%s" '
                . 'received.',
                is_object($reasonPhrase) ? get_class($reasonPhrase)
                                         : gettype($reasonPhrase)
            ));
        }
        if (! preg_match('#\A\d{3}\Z#', $code)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid status code provided; must be a 3-digit integer result'
                . ' code, "%s" received.',
                is_scalar($code) ? $code : gettype($code)
            ));
        }
        if ($code < 100 || $code > 599) {
            throw new InvalidArgumentException(
                'Invalid status code provided; must be between 100 and 599.'
            );
        }
        $this->statusCode   = (int) $code;
        $this->reasonPhrase = $reasonPhrase;

        return $this;
    }