Supported Versions: PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8
                                                    Retrieve options for a stream/wrapper/context
                                                                <?php stream_context_get_options(resource $stream_or_context): array
    <?php         $io->write('Checking https connectivity to packagist: ', false);
        $this->outputResult($this->checkHttp('https', $config));
        $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
        if (!empty($opts['http']['proxy'])) {
            $io->write('Checking HTTP proxy: ', false);
            $this->outputResult($this->checkHttpProxy());
    <?php     public function testGetContext($expectedOptions, $defaultOptions, $expectedParams, $defaultParams)
    {
        $context = StreamContextFactory::getContext('http://example.org', $defaultOptions, $defaultParams);
        $options = stream_context_get_options($context);
        $params = stream_context_get_params($context);
        $this->assertEquals($expectedOptions, $options);
    <?php         $_SERVER['HTTP_PROXY'] = 'http://proxyserver/';
        $context = StreamContextFactory::getContext('http://example.org', array('http' => array('method' => 'GET', 'header' => 'User-Agent: foo')));
        $options = stream_context_get_options($context);
        $this->assertEquals(array('http' => array(
            'proxy' => 'tcp://proxyserver.net:3128',
    <?php         $_SERVER['no_proxy'] = 'foo,example.org';
        $context = StreamContextFactory::getContext('http://example.org', array('http' => array('method' => 'GET', 'header' => 'User-Agent: foo')));
        $options = stream_context_get_options($context);
        $this->assertEquals(array('http' => array(
            'method' => 'GET',
    <?php         $_SERVER['no_proxy'] = '*';
        $context = StreamContextFactory::getContext('http://example.org', array('http' => array('method' => 'GET', 'header' => 'User-Agent: foo')));
        $options = stream_context_get_options($context);
        $this->assertEquals(array('http' => array(
            'method' => 'GET',
    <?php         $_SERVER['http_proxy'] = 'http://username:password@proxyserver.net:3128/';
        $context = StreamContextFactory::getContext('http://example.org', array('http' => array('method' => 'GET', 'header' => array('User-Agent: foo', "X-Foo: bar"), 'request_fulluri' => false)));
        $options = stream_context_get_options($context);
        $this->assertEquals(array('http' => array(
            'proxy' => 'tcp://proxyserver.net:3128',
    <?php         $_SERVER['http_proxy'] = 'http://username:password@proxyserver.net';
        $context = StreamContextFactory::getContext('https://example.org', array('http' => array('method' => 'GET', 'header' => 'User-Agent: foo')));
        $options = stream_context_get_options($context);
        $this->assertEquals(array('http' => array(
            'proxy' => 'tcp://proxyserver.net:80',
    <?php         if (extension_loaded('openssl')) {
            $context = StreamContextFactory::getContext('http://example.org', array('http' => array('header' => 'User-Agent: foo')));
            $options = stream_context_get_options($context);
            $this->assertEquals(array('http' => array(
                'proxy' => $expected,
    <?php             ),
        );
        $context = StreamContextFactory::getContext('http://example.org', $options);
        $ctxoptions = stream_context_get_options($context);
        $this->assertEquals(end($expectedOptions['http']['header']), end($ctxoptions['http']['header']));
    }