public function initialize(
        string $protocol = 'http',
        string $protocolVersion = '1.1',
        $headers = null,
        $body = 'php://memory'
    ): void {
        $this->protocol        = $protocol ?: 'http';
        $this->protocolVersion = $protocolVersion ?: '1.1';

        if ($headers) {
            $this->headers = $headers instanceof Headers ? $headers : new Headers($headers);
        } else {
            $this->headers = new Headers();
        }

        $this->body = $this->createBodyStream($body);
    }
public function initialize(
        string $protocol = 'http',
        string $protocolVersion = '1.1',
        $headers = null,
        $body = 'php://memory'
    ): void {
        $this->protocol        = $protocol ?: 'http';
        $this->protocolVersion = $protocolVersion ?: '1.1';

        if ($headers) {
            $this->headers = $headers instanceof Headers ? $headers : new Headers($headers);
        } else {
            $this->headers = new Headers();
        }

        $this->body = $this->createBodyStream($body);
    }
public function initialize ( string $ protocol = 'http' , string $ protocolVersion = '1.1' , $ headers = null , $ body = 'php://memory' ) : void { $ this -> protocol = $ protocol ? : 'http' ; $ this -> protocolVersion = $ protocolVersion ? : '1.1' ; if ( $ headers ) { $ this -> headers = $ headers instanceof Headers ? $ headers : new Headers ( $ headers ) ; } else { $ this -> headers = new Headers ( ) ; } $ this -> body = $ this -> createBodyStream ( $ body ) ; }
BaseMessage constructor.
@param string                          $protocol
@param string                          $protocolVersion
@param array|Headers                   $headers
@param string|resource|StreamInterface $body
@throws \InvalidArgumentException
BaseMessage constructor .