private function initMultiCurlHandle(): void
    {
        $this->curlm = curl_multi_init();
        if (false === $this->curlm) {
            throw new ClientException('Unable to create a new cURL multi handle');
        }

        if ($this->serverPushSupported) {
            $userCallbacks = $this->pushFunctions;

            curl_multi_setopt($this->curlm, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);
            // We need to use $this->pushCb[] because of a bug in PHP
            curl_multi_setopt(
                $this->curlm,
                CURLMOPT_PUSHFUNCTION,
                $this->pushCb[] = function ($parent, $pushed, $headers) use ($userCallbacks) {
                    // If any callback say no, then do not accept.
                    foreach ($userCallbacks as $callback) {
                        if (CURL_PUSH_DENY === $callback($parent, $pushed, $headers)) {
                            return CURL_PUSH_DENY;
                        }
                    }

                    curl_setopt($pushed, CURLOPT_RETURNTRANSFER, true);
                    curl_setopt($pushed, CURLOPT_HEADER, true);
                    $this->addPushHandle($headers, $pushed);

                    return CURL_PUSH_OK;
                }
            );
        }
    }
private function initMultiCurlHandle(): void
    {
        $this->curlm = curl_multi_init();
        if (false === $this->curlm) {
            throw new ClientException('Unable to create a new cURL multi handle');
        }

        if ($this->serverPushSupported) {
            $userCallbacks = $this->pushFunctions;

            curl_multi_setopt($this->curlm, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);
            // We need to use $this->pushCb[] because of a bug in PHP
            curl_multi_setopt(
                $this->curlm,
                CURLMOPT_PUSHFUNCTION,
                $this->pushCb[] = function ($parent, $pushed, $headers) use ($userCallbacks) {
                    // If any callback say no, then do not accept.
                    foreach ($userCallbacks as $callback) {
                        if (CURL_PUSH_DENY === $callback($parent, $pushed, $headers)) {
                            return CURL_PUSH_DENY;
                        }
                    }

                    curl_setopt($pushed, CURLOPT_RETURNTRANSFER, true);
                    curl_setopt($pushed, CURLOPT_HEADER, true);
                    $this->addPushHandle($headers, $pushed);

                    return CURL_PUSH_OK;
                }
            );
        }
    }
private function initMultiCurlHandle ( ) : void { $ this -> curlm = curl_multi_init ( ) ; if ( false === $ this -> curlm ) { throw new ClientException ( 'Unable to create a new cURL multi handle' ) ; } if ( $ this -> serverPushSupported ) { $ userCallbacks = $ this -> pushFunctions ; curl_multi_setopt ( $ this -> curlm , CURLMOPT_PIPELINING , CURLPIPE_MULTIPLEX ) ; // We need to use $this->pushCb[] because of a bug in PHP curl_multi_setopt ( $ this -> curlm , CURLMOPT_PUSHFUNCTION , $ this -> pushCb [ ] = function ( $ parent , $ pushed , $ headers ) use ( $ userCallbacks ) { // If any callback say no, then do not accept. foreach ( $ userCallbacks as $ callback ) { if ( CURL_PUSH_DENY === $ callback ( $ parent , $ pushed , $ headers ) ) { return CURL_PUSH_DENY ; } } curl_setopt ( $ pushed , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ pushed , CURLOPT_HEADER , true ) ; $ this -> addPushHandle ( $ headers , $ pushed ) ; return CURL_PUSH_OK ; } ) ; } }
Create a multi curl handle and add some properties to it.
Create a multi curl handle and add some properties to it .