private function createStream(
        RequestInterface $request,
        &$http_response_header
    ) {
        static $methods;
        if (!$methods) {
            $methods = array_flip(get_class_methods(__CLASS__));
        }

        $params = [];
        $options = $this->getDefaultOptions($request);
        foreach ($request->getConfig()->toArray() as $key => $value) {
            $method = "add_{$key}";
            if (isset($methods[$method])) {
                $this->{$method}($request, $options, $value, $params);
            }
        }

        $this->applyCustomOptions($request, $options);
        $context = $this->createStreamContext($request, $options, $params);

        return $this->createStreamResource(
            $request,
            $options,
            $context,
            $http_response_header
        );
    }
private function createStream(
        RequestInterface $request,
        &$http_response_header
    ) {
        static $methods;
        if (!$methods) {
            $methods = array_flip(get_class_methods(__CLASS__));
        }

        $params = [];
        $options = $this->getDefaultOptions($request);
        foreach ($request->getConfig()->toArray() as $key => $value) {
            $method = "add_{$key}";
            if (isset($methods[$method])) {
                $this->{$method}($request, $options, $value, $params);
            }
        }

        $this->applyCustomOptions($request, $options);
        $context = $this->createStreamContext($request, $options, $params);

        return $this->createStreamResource(
            $request,
            $options,
            $context,
            $http_response_header
        );
    }
private function createStream ( RequestInterface $ request , & $ http_response_header ) { static $ methods ; if ( ! $ methods ) { $ methods = array_flip ( get_class_methods ( __CLASS__ ) ) ; } $ params = [ ] ; $ options = $ this -> getDefaultOptions ( $ request ) ; foreach ( $ request -> getConfig ( ) -> toArray ( ) as $ key => $ value ) { $ method = "add_{$key}" ; if ( isset ( $ methods [ $ method ] ) ) { $ this -> { $ method } ( $ request , $ options , $ value , $ params ) ; } } $ this -> applyCustomOptions ( $ request , $ options ) ; $ context = $ this -> createStreamContext ( $ request , $ options , $ params ) ; return $ this -> createStreamResource ( $ request , $ options , $ context , $ http_response_header ) ; }
Create the stream for the request with the context options.

@param RequestInterface $request              Request being sent
@param mixed            $http_response_header Populated by stream wrapper

@return resource
Create the stream for the request with the context options .