private function prepareHttp(Configuration\HttpConfiguration $config)
    {
        switch ($config->method) {
            case 'GET':
                $this->options[CURLOPT_HTTPGET] = true;
                break;
            case 'PUT':
                if (is_resource($config->body)) {
                    $this->options[CURLOPT_PUT] = true;
                } else {
                    $this->options[CURLOPT_CUSTOMREQUEST] = 'PUT';
                }
                break;
            default:
                $this->options[CURLOPT_CUSTOMREQUEST] = $config->method;
        }

        if ($config->redirectsAllowed()) {
            $this->options[CURLOPT_AUTOREFERER] = $config->allowRedirectsReferer();
            $this->options[CURLOPT_MAXREDIRS] = $config->allowRedirectsMax();
        } else {
            $this->options[CURLOPT_FOLLOWLOCATION] = false;
        }

        if (null !== $config->accept_encoding) {
            $this->options[CURLOPT_ENCODING] = $config->accept_encoding;
        }

        if (true === $config->verify) {
            $this->options[CURLOPT_SSL_VERIFYPEER] = true;
            $this->options[CURLOPT_SSL_VERIFYHOST] = 2;
            $this->options[CURLOPT_CAINFO] = CaBundle::getSystemCaRootBundlePath();
        } else {
            $this->options[CURLOPT_SSL_VERIFYPEER] = false;
            $this->options[CURLOPT_SSL_VERIFYHOST] = 0;
        }
    }
private function prepareHttp(Configuration\HttpConfiguration $config)
    {
        switch ($config->method) {
            case 'GET':
                $this->options[CURLOPT_HTTPGET] = true;
                break;
            case 'PUT':
                if (is_resource($config->body)) {
                    $this->options[CURLOPT_PUT] = true;
                } else {
                    $this->options[CURLOPT_CUSTOMREQUEST] = 'PUT';
                }
                break;
            default:
                $this->options[CURLOPT_CUSTOMREQUEST] = $config->method;
        }

        if ($config->redirectsAllowed()) {
            $this->options[CURLOPT_AUTOREFERER] = $config->allowRedirectsReferer();
            $this->options[CURLOPT_MAXREDIRS] = $config->allowRedirectsMax();
        } else {
            $this->options[CURLOPT_FOLLOWLOCATION] = false;
        }

        if (null !== $config->accept_encoding) {
            $this->options[CURLOPT_ENCODING] = $config->accept_encoding;
        }

        if (true === $config->verify) {
            $this->options[CURLOPT_SSL_VERIFYPEER] = true;
            $this->options[CURLOPT_SSL_VERIFYHOST] = 2;
            $this->options[CURLOPT_CAINFO] = CaBundle::getSystemCaRootBundlePath();
        } else {
            $this->options[CURLOPT_SSL_VERIFYPEER] = false;
            $this->options[CURLOPT_SSL_VERIFYHOST] = 0;
        }
    }
private function prepareHttp ( Configuration \ HttpConfiguration $ config ) { switch ( $ config -> method ) { case 'GET' : $ this -> options [ CURLOPT_HTTPGET ] = true ; break ; case 'PUT' : if ( is_resource ( $ config -> body ) ) { $ this -> options [ CURLOPT_PUT ] = true ; } else { $ this -> options [ CURLOPT_CUSTOMREQUEST ] = 'PUT' ; } break ; default : $ this -> options [ CURLOPT_CUSTOMREQUEST ] = $ config -> method ; } if ( $ config -> redirectsAllowed ( ) ) { $ this -> options [ CURLOPT_AUTOREFERER ] = $ config -> allowRedirectsReferer ( ) ; $ this -> options [ CURLOPT_MAXREDIRS ] = $ config -> allowRedirectsMax ( ) ; } else { $ this -> options [ CURLOPT_FOLLOWLOCATION ] = false ; } if ( null !== $ config -> accept_encoding ) { $ this -> options [ CURLOPT_ENCODING ] = $ config -> accept_encoding ; } if ( true === $ config -> verify ) { $ this -> options [ CURLOPT_SSL_VERIFYPEER ] = true ; $ this -> options [ CURLOPT_SSL_VERIFYHOST ] = 2 ; $ this -> options [ CURLOPT_CAINFO ] = CaBundle :: getSystemCaRootBundlePath ( ) ; } else { $ this -> options [ CURLOPT_SSL_VERIFYPEER ] = false ; $ this -> options [ CURLOPT_SSL_VERIFYHOST ] = 0 ; } }
Specific method to prepare HTTP requests options
@param Configuration\HttpConfiguration $config
Specific method to prepare HTTP requests options