public function setStatus($statusLine)
    {
        $parts = explode(' ', $statusLine, 3);
        if (count($parts) < 2 || 0 !== strpos(strtolower($parts[0]), 'http/')) {
            throw new \InvalidArgumentException(
                sprintf('"%s" is not a valid HTTP status line', $statusLine)
            );
        }

        $reasonPhrase = count($parts) > 2 ? $parts[2] : '';
        $this->response = $this->response
            ->withStatus((int) $parts[1], $reasonPhrase)
            ->withProtocolVersion(substr($parts[0], 5));

        return $this;
    }
public function setStatus($statusLine)
    {
        $parts = explode(' ', $statusLine, 3);
        if (count($parts) < 2 || 0 !== strpos(strtolower($parts[0]), 'http/')) {
            throw new \InvalidArgumentException(
                sprintf('"%s" is not a valid HTTP status line', $statusLine)
            );
        }

        $reasonPhrase = count($parts) > 2 ? $parts[2] : '';
        $this->response = $this->response
            ->withStatus((int) $parts[1], $reasonPhrase)
            ->withProtocolVersion(substr($parts[0], 5));

        return $this;
    }
public function setStatus ( $ statusLine ) { $ parts = explode ( ' ' , $ statusLine , 3 ) ; if ( count ( $ parts ) < 2 || 0 !== strpos ( strtolower ( $ parts [ 0 ] ) , 'http/' ) ) { throw new \ InvalidArgumentException ( sprintf ( '"%s" is not a valid HTTP status line' , $ statusLine ) ) ; } $ reasonPhrase = count ( $ parts ) > 2 ? $ parts [ 2 ] : '' ; $ this -> response = $ this -> response -> withStatus ( ( int ) $ parts [ 1 ] , $ reasonPhrase ) -> withProtocolVersion ( substr ( $ parts [ 0 ] , 5 ) ) ; return $ this ; }
Set response status from a status string.

@param string $statusLine Response status as a string.

@return $this

@throws \InvalidArgumentException For invalid status line.
Set response status from a status string .