Returns current \SoapClient::_stream_context resource options or empty array
@return array
355107
public function getStreamContextOptions()
    {
        $options = [];
        $context = $this->getStreamContext();
        if ($context !== null) {
            $options = stream_context_get_options($context);
        }
        return $options;
    }
437751
public function toStreamContextArray(): array
    {
        $options = [
            'crypto_method' => $this->toStreamCryptoMethod(),
            'peer_name' => $this->peerName,
            'verify_peer' => $this->verifyPeer,
            'verify_peer_name' => $this->verifyPeer,
            'verify_depth' => $this->verifyDepth,
            'ciphers' => $this->ciphers ?? \OPENSSL_DEFAULT_STREAM_CIPHERS,
            'capture_peer_cert' => $this->capturePeer,
            'capture_peer_cert_chain' => $this->capturePeer,
            'SNI_enabled' => $this->sniEnabled,
        ];

        if ($this->certificate !== null) {
            $options['local_cert'] = $this->certificate->getCertFile();

            if ($this->certificate->getCertFile() !== $this->certificate->getKeyFile()) {
                $options['local_pk'] = $this->certificate->getKeyFile();
            }
        }

        if ($this->caFile !== null) {
            $options['cafile'] = $this->caFile;
        }

        if ($this->caPath !== null) {
            $options['capath'] = $this->caPath;
        }

        if (\OPENSSL_VERSION_NUMBER >= 0x10100000) {
            $options['security_level'] = $this->securityLevel;
        }

        return ['ssl' => $options];
    }
860587
public function applyContextToStream()
	{
		$retval = false;

		if ($this->fh)
		{
			// Capture PHP errors
			$php_errormsg = 'Unknown error setting context option';
			$track_errors = ini_get('track_errors');
			ini_set('track_errors', true);
			$retval = @stream_context_set_option($this->fh, $this->contextOptions);

			if (!$retval)
			{
				throw new \RuntimeException($php_errormsg);
			}

			// Restore error tracking to what it was before
			ini_set('track_errors', $track_errors);
		}

		return $retval;
	}
105175
protected function buildStreamContext()
    {
        $opts = [];

        // If we have a logger defined, merge the context options from our logger with the context array
        if ($this->logQueries() && $logger = $this->logger()) {
            $opts['mongodb'] = $logger->getContext();
        }

        $context = stream_context_create($opts);
        return ['context' => $context];
    }
170519
protected function getContextOptions($all = false)
    {
        if ($this->contextOptions === null) {
            $this->contextOptions   = stream_context_get_options($this->context);
        }

        if (!$all && array_key_exists(self::$protocol, $this->contextOptions)) {
            return $this->contextOptions[self::$protocol];
        } else if ($all) {
            return $this->contextOptions;
        } else {
            return array();
        }
    }
980784
protected function getClientOptions()
    {
        $options = $this->getOptions();
        if (!isset($options['headers']) || !isset($options['headers']['Content-Type'])) {
            $options['headers']['Content-Type'] = ['application/json'];
        } else {
            if (!in_array('application/json', $options['headers']['Content-Type'])) {
                $options['headers']['Content-Type'][] = ['application/json'];
            }
        }
        return $options;
    }
28440
public function _buildContext()
	{
		// According to the manual this always works!
		if (\count($this->contextOptions))
		{
			$this->context = @stream_context_create($this->contextOptions);
		}
		else
		{
			$this->context = null;
		}
	}
722774
public function toStreamOptions()
    {
        $options = array();
        $options['verify_peer'] = $this->verifyPeer;
        if ($this->caFile) {
            $options['cafile'] = $this->caFile;
        } // else: system default
        return $options;
    }
931659
public function getContext()
    {
        return [
            'username' => $this->username,
            'requestPath' => $this->requestPath,
            'errors' => $this->errors,
            'groups' => $this->groups,
            'successful' => !$this->errors
        ];
    }
869373
public function getContents(){
        if(null === $this->resource){
            throw new Exception\StreamUnavailableException(
                static::EXCEPTION_MSG_UNAVAILABLE
            );
        }

        if(!$this->isReadable()){
            throw new Exception\StreamUnreadableException(
                static::EXCEPTION_MSG_UNREADABLE
            );
        }

        if(false === ($contents = stream_get_contents($this->resource))){
            throw new \RuntimeException("Failed to read stream.");
        }

        return $contents;
    }
707523
public function getStream($context = null)
	{
		if (is_null($context)) {
			return fopen($this->path, 'rb', false);
		} else {
			return fopen($this->path, 'rb', false, $context);
		}
	}
334012
public function getStream()
    {
        $this->validateActive();

        if ($this->stream instanceof StreamInterface) {
            return $this->stream;
        }

        return new LazyOpenStream($this->file, 'r+');
    }
1070605
public static function get_available_in_context($contexts) {
        $params = self::validate_parameters(self::get_available_in_context_parameters(), array('contexts' => $contexts));
        $filters = $warnings = array();

        foreach ($params['contexts'] as $contextinfo) {
            try {
                $context = self::get_context_from_params($contextinfo);
                self::validate_context($context);
                $contextinfo['contextid'] = $context->id;
            } catch (Exception $e) {
                $warnings[] = array(
                    'item' => 'context',
                    'itemid' => $context['instanceid'],
                    'warningcode' => $e->getCode(),
                    'message' => $e->getMessage(),
                );
                continue;
            }
            $contextfilters = filter_get_available_in_context($context);

            foreach ($contextfilters as $filter) {
                $filters[] = array_merge($contextinfo, (array) $filter);
            }
        }

        return array(
            'filters' => $filters,
            'warnings' => $warnings,
        );
    }
660706
protected function getStreamContext($listen = false)
    {
        $options = [];

        if ($this->scheme == Protocol::SCHEME_UNDERLYING_SECURE
            || $this->scheme == Protocol::SCHEME_UNDERLYING
        ) {
            $options['socket'] = $this->getSocketStreamContextOptions();
        }

        if ($this->scheme == Protocol::SCHEME_UNDERLYING_SECURE) {
            $options['ssl'] = $this->getSslStreamContextOptions();
        }

        return stream_context_create(
            $options,
            []
        );
    }
1138704
public function getSpacesAndContentTypesAsChoices(): array
    {
        $spaces = [];

        foreach ($this->clientsConfig as $clientConfig) {
            /** @var \Contentful\Delivery\Client $client */
            $client = $clientConfig['service'];

            $contentTypes = [];
            foreach ($client->getContentTypes()->getItems() as $contentType) {
                /* @var \Contentful\Delivery\Resource\ContentType $contentType */
                $contentTypes[$contentType->getName()] = $contentType->getId();
            }
            $spaces[$client->getSpace()->getName()] = $contentTypes;
        }

        return $spaces;
    }
970192
protected function getStreamContext()
    {
        $ctx = stream_context_create();

        stream_context_set_option($ctx, "ssl", "local_cert", $this->pem);
        if (strlen($this->passphrase)) {
            stream_context_set_option($ctx, "ssl", "passphrase", $this->passphrase);
        }

        return $ctx;
    }
458606
public function getSoapOptions()
    {
        $soapOptions = [
            'ID_Application' => $this->appId,
            'soap_version' => SOAP_1_2,
            'encoding' => 'utf-8',
        ];

        if ($this->compression) {
            $soapOptions['compression'] = SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP;
        }

        $soapOptions['cache_wsdl'] = $this->cache ? WSDL_CACHE_BOTH : WSDL_CACHE_NONE;

        return $soapOptions;
    }