src/Graviton/CoreBundle/Compiler/HttpClientOptionsCompilerPass.php
public function process(ContainerBuilder $container)
    {
        $baseOptions = [
            'verify' => false
        ];

        // system settings envs
        if (isset($_ENV['HTTP_PROXY']) && !empty($_ENV['HTTP_PROXY'])) {
            $this->setProxy($_ENV['HTTP_PROXY'], 'http');
        }
        if (isset($_ENV['HTTPS_PROXY']) && !empty($_ENV['HTTPS_PROXY'])) {
            $this->setProxy($_ENV['HTTPS_PROXY'], 'https');
        }
        if (isset($_ENV['NO_PROXY']) && !empty($_ENV['NO_PROXY'])) {
            $this->setNoProxyList($_ENV['NO_PROXY']);
        }

        // is there the old setting?
        if (isset($_ENV['GRAVITON_PROXY_CURLOPTS'])) {
            $yamlSettings = Yaml::parse($_ENV['GRAVITON_PROXY_CURLOPTS']);
            if (is_array($yamlSettings) && isset($yamlSettings['proxy'])) {
                $this->setProxy($yamlSettings['proxy']);
            }
            if (is_array($yamlSettings) && isset($yamlSettings['noproxy'])) {
                $this->setNoProxyList($yamlSettings['noproxy']);
            }
        }

        // new settings -> override all
        if (null !== $container->getParameter('graviton.proxy')) {
            $this->setProxy($container->getParameter('graviton.proxy'));
        }
        if (null !== $container->getParameter('graviton.noproxy')) {
            $this->setNoProxyList($container->getParameter('graviton.noproxy'));
        }

        // any proxy?
        if (!empty($this->proxySettings)) {
            $baseOptions['proxy'] = $this->proxySettings;
        }

        $container->setParameter(
            'graviton.core.http.client.options',
            $baseOptions
        );
    }
public function process(ContainerBuilder $container)
    {
        $baseOptions = [
            'verify' => false
        ];

        // system settings envs
        if (isset($_ENV['HTTP_PROXY']) && !empty($_ENV['HTTP_PROXY'])) {
            $this->setProxy($_ENV['HTTP_PROXY'], 'http');
        }
        if (isset($_ENV['HTTPS_PROXY']) && !empty($_ENV['HTTPS_PROXY'])) {
            $this->setProxy($_ENV['HTTPS_PROXY'], 'https');
        }
        if (isset($_ENV['NO_PROXY']) && !empty($_ENV['NO_PROXY'])) {
            $this->setNoProxyList($_ENV['NO_PROXY']);
        }

        // is there the old setting?
        if (isset($_ENV['GRAVITON_PROXY_CURLOPTS'])) {
            $yamlSettings = Yaml::parse($_ENV['GRAVITON_PROXY_CURLOPTS']);
            if (is_array($yamlSettings) && isset($yamlSettings['proxy'])) {
                $this->setProxy($yamlSettings['proxy']);
            }
            if (is_array($yamlSettings) && isset($yamlSettings['noproxy'])) {
                $this->setNoProxyList($yamlSettings['noproxy']);
            }
        }

        // new settings -> override all
        if (null !== $container->getParameter('graviton.proxy')) {
            $this->setProxy($container->getParameter('graviton.proxy'));
        }
        if (null !== $container->getParameter('graviton.noproxy')) {
            $this->setNoProxyList($container->getParameter('graviton.noproxy'));
        }

        // any proxy?
        if (!empty($this->proxySettings)) {
            $baseOptions['proxy'] = $this->proxySettings;
        }

        $container->setParameter(
            'graviton.core.http.client.options',
            $baseOptions
        );
    }
public function process ( ContainerBuilder $ container ) { $ baseOptions = [ 'verify' => false ] ; // system settings envs if ( isset ( $ _ENV [ 'HTTP_PROXY' ] ) && ! empty ( $ _ENV [ 'HTTP_PROXY' ] ) ) { $ this -> setProxy ( $ _ENV [ 'HTTP_PROXY' ] , 'http' ) ; } if ( isset ( $ _ENV [ 'HTTPS_PROXY' ] ) && ! empty ( $ _ENV [ 'HTTPS_PROXY' ] ) ) { $ this -> setProxy ( $ _ENV [ 'HTTPS_PROXY' ] , 'https' ) ; } if ( isset ( $ _ENV [ 'NO_PROXY' ] ) && ! empty ( $ _ENV [ 'NO_PROXY' ] ) ) { $ this -> setNoProxyList ( $ _ENV [ 'NO_PROXY' ] ) ; } // is there the old setting? if ( isset ( $ _ENV [ 'GRAVITON_PROXY_CURLOPTS' ] ) ) { $ yamlSettings = Yaml :: parse ( $ _ENV [ 'GRAVITON_PROXY_CURLOPTS' ] ) ; if ( is_array ( $ yamlSettings ) && isset ( $ yamlSettings [ 'proxy' ] ) ) { $ this -> setProxy ( $ yamlSettings [ 'proxy' ] ) ; } if ( is_array ( $ yamlSettings ) && isset ( $ yamlSettings [ 'noproxy' ] ) ) { $ this -> setNoProxyList ( $ yamlSettings [ 'noproxy' ] ) ; } } // new settings -> override all if ( null !== $ container -> getParameter ( 'graviton.proxy' ) ) { $ this -> setProxy ( $ container -> getParameter ( 'graviton.proxy' ) ) ; } if ( null !== $ container -> getParameter ( 'graviton.noproxy' ) ) { $ this -> setNoProxyList ( $ container -> getParameter ( 'graviton.noproxy' ) ) ; } // any proxy? if ( ! empty ( $ this -> proxySettings ) ) { $ baseOptions [ 'proxy' ] = $ this -> proxySettings ; } $ container -> setParameter ( 'graviton.core.http.client.options' , $ baseOptions ) ; }
add guzzle options

@param ContainerBuilder $container Container

@return void
add guzzle options