src/Response.php
public function withStatus($code, $reason = '')
    {
        $code = Validator::checkCode($code);

        if (!is_string($reason) && !method_exists($reason, '__toString')) {
            throw new InvalidArgumentException('ReasonPhrase must be a string');
        }

        $clone = clone $this;
        $clone->code = $code;
        if ($reason === '') {
            $reason = Validator::getCodeMessage($code);
        }

        if ($reason === '') {
            throw new InvalidArgumentException('ReasonPhrase must be supplied for this code');
        }

        $clone->phrase = $reason;

        return $clone;
    }
public function withStatus($code, $reason = '')
    {
        $code = Validator::checkCode($code);

        if (!is_string($reason) && !method_exists($reason, '__toString')) {
            throw new InvalidArgumentException('ReasonPhrase must be a string');
        }

        $clone = clone $this;
        $clone->code = $code;
        if ($reason === '') {
            $reason = Validator::getCodeMessage($code);
        }

        if ($reason === '') {
            throw new InvalidArgumentException('ReasonPhrase must be supplied for this code');
        }

        $clone->phrase = $reason;

        return $clone;
    }
public function withStatus ( $ code , $ reason = '' ) { $ code = Validator :: checkCode ( $ code ) ; if ( ! is_string ( $ reason ) && ! method_exists ( $ reason , '__toString' ) ) { throw new InvalidArgumentException ( 'ReasonPhrase must be a string' ) ; } $ clone = clone $ this ; $ clone -> code = $ code ; if ( $ reason === '' ) { $ reason = Validator :: getCodeMessage ( $ code ) ; } if ( $ reason === '' ) { throw new InvalidArgumentException ( 'ReasonPhrase must be supplied for this code' ) ; } $ clone -> phrase = $ reason ; return $ clone ; }
Return an instance with the specified status code and, optionally, reason phrase
Return an instance with the specified status code and optionally reason phrase