Get the stream context options available to the current stream

@param bool $removeContextData Set to true to remove contextual kvp's
like 'client' from the result.

@return array
556839
private function getOptions($removeContextData = false)
    {
        // Context is not set when doing things like stat
        if ($this->context === null) {
            $options = [];
        } else {
            $options = stream_context_get_options($this->context);
            $options = isset($options[$this->protocol])
                ? $options[$this->protocol]
                : [];
        }

        $default = stream_context_get_options(stream_context_get_default());
        $default = isset($default[$this->protocol])
            ? $default[$this->protocol]
            : [];
        $result = $this->params + $options + $default;

        if ($removeContextData) {
            unset($result['client'], $result['seekable'], $result['cache']);
        }

        return $result;
    }
970188
public static function trim(array $contentData)
    {
        $data = [];

        foreach ($contentData as $item) {
            $data[] = trim($item);
        }

        return $data;
    }
395140
public function serializePayload(ControllerContext $controllerContext)
    {
        return [
            'contextPath' => $this->getNode()->getContextPath(),
            'parentContextPath' => $this->getNode()->getParent()->getContextPath()
        ];
    }
609912
public function getPluginNodesWithViewDefinitions(ContentContext $context)
    {
        $pluginNodes = [];
        foreach ($this->getPluginNodes($context) as $pluginNode) {
            /** @var NodeInterface $pluginNode */
            if ($this->getPluginViewDefinitionsByPluginNodeType($pluginNode->getNodeType()) !== []) {
                $pluginNodes[] = $pluginNode;
            }
        }
        return $pluginNodes;
    }
357228
protected function getConstraints(array $contextData, AbstractEntity $contextEntity = null)
    {
        $notBlank = new Assert\NotBlank(['message' => self::BLANK]);

        $constraints = [
            'email' => new Assert\Optional([
                $notBlank,
                new Assert\Email([
                    'checkHost' => true
                ]),
            ]),
            'password' => new Assert\Optional([$notBlank])
        ];

        if (isset($contextData['email']) or isset($contextData['password'])) {
            $constraints['current_password'] = [
                $notBlank,
                new Assert\Callback(['callback' => [$this, 'validateCurrentPassword']]),
            ];
        }

        return $constraints;
    }
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;
    }
562404
protected function _getStreamContext($recreate = false)
    {
        if (!isset($this->_streamContext) || true === $recreate) {
            $this->_streamContext = stream_context_create($this->_streamContextOptions);
        }

        return $this->_streamContext;
    }
632326
public function upcast(SerializedEvent $event, UpcastingContext $context)
    {
        $result = [];
        $events = [$event];

        foreach ($this->upcasters as $upcaster) {
            $result = [];

            foreach ($events as $event) {
                if ($upcaster->supports($event)) {
                    $upcasted = $upcaster->upcast($event, $context);

                    // TODO: remove support of non array values by upcasters in next major release
                    if (!is_array($upcasted)) {
                        @trigger_error(
                            'Upcasters need to return an array collection of upcasted events, ' .
                            'non array return values are deprecated and support will be removed in the next major release',
                            E_USER_DEPRECATED
                        );

                        $upcasted = [$upcasted];
                    }

                    array_push($result, ...$upcasted);
                }
            }

            $events = $result;
        }

        return $result;
    }
305487
private function getStreamContext()
    {
        $context = array(
            'ssl' => array(
                'local_cert' => $this->params['ssl_pem_path'],
            ),
        );

        // Handle Certificate Bundle passphrase
        if (!empty($this->params['ssl_passphrase'])) {
            $context['ssl']['passphrase'] = $this->params['ssl_passphrase'];
        }

        return stream_context_create($context);
    }
1078993
protected function getRequestHeaders($sendData = false)
    {
        $headers = [
            'Accept'     => 'application/json',
            'User-Agent' => $this->options->userAgent() . '/' . Client::VERSION,
        ];

        if ($sendData) {
            $headers['Content-Type'] = 'application/json;charset=utf-8';
        }

        return $headers;
    }
1091147
function toContext()
    {
        $options  = new Std\Type\StdTravers($this);
        $options  = $options->toArray(function($val) {
            ### we don`t want null values on context params
            return ($val === null);
        });

        $params = (isset($options['params'])) ? $options['params'] : array();
        unset($options['params']);


        if (isset($options['options']))
            // We get bind context below; so unset here
            /** @see self::getItterator() */
            unset($options['options']);

        $options = array(
            $this->getWrapperName() => $options,
        );

        $bindOptions = $this->_getBindContextOptions();
        $options     = array_merge($bindOptions, $options);

        $context = stream_context_create($options, $params);
        return $context;
    }
1255877
public function getStreamContext()
    {
        // set basic stream context configuration
        $config = [
            'tcp' => [
                'method'          => 'GET',
                'user_agent'      => $this->loader->getUserAgent(),
                // ignore errors, handle them manually
                'ignore_errors'   => true,
                'request_fulluri' => true,
                'timeout'         => $this->loader->getTimeout(),
            ],
        ];

        // check and set proxy settings
        $proxy_host = $this->loader->getOption('ProxyHost');
        if (null !== $proxy_host) {
            // check for supported protocol
            $proxy_protocol = $this->loader->getOption('ProxyProtocol');
            if (null !== $proxy_protocol) {
                if (!in_array($proxy_protocol, [self::PROXY_PROTOCOL_HTTP, self::PROXY_PROTOCOL_HTTPS])) {
                    throw new Exception(
                        'Invalid/unsupported value "' . $proxy_protocol . '" for option "ProxyProtocol".',
                        Exception::INVALID_OPTION
                    );
                }
            } else {
                $proxy_protocol = self::PROXY_PROTOCOL_HTTP;
            }

            // prepare port for the proxy server address
            $proxy_port = $this->loader->getOption('ProxyPort');
            if (null !== $proxy_port) {
                $proxy_port = ':' . $proxy_port;
            } else {
                $proxy_port = '';
            }

            // check auth settings
            $proxy_auth = $this->loader->getOption('ProxyAuth');
            if (null !== $proxy_auth) {
                if (!in_array($proxy_auth, [self::PROXY_AUTH_BASIC])) {
                    throw new Exception(
                        'Invalid/unsupported value "' . $proxy_auth . '" for option "ProxyAuth".',
                        Exception::INVALID_OPTION
                    );
                }
            } else {
                $proxy_auth = self::PROXY_AUTH_BASIC;
            }

            // set proxy server address
            $config['http']['proxy'] = 'tcp://' . $proxy_host . $proxy_port;
            // full uri required by some proxy servers
            $config['http']['request_fulluri'] = true;

            // add authorization header if required
            $proxy_user = $this->loader->getOption('ProxyUser');
            if (null !== $proxy_user) {
                $proxy_password = $this->loader->getOption('ProxyPassword');
                if (null === $proxy_password) {
                    $proxy_password = '';
                }
                $auth                     = base64_encode($proxy_user . ':' . $proxy_password);
                $config['http']['header'] = 'Proxy-Authorization: Basic ' . $auth;
            }
        }

        return stream_context_create($config);
    }
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,
            []
        );
    }
335070
public function getVisitor(ValidationContext $context)
    {
        return [
            NodeKind::OPERATION_DEFINITION => function (OperationDefinitionNode $node) use ($context) {
                if ($node->operation === 'subscription') {
                    if (count($node->selectionSet->selections) !== 1) {
                        $context->reportError(
                            new Error(
                                $this->singleFieldOnlyMessage($node->name ? $node->name->value : null),
                                array_slice($node->selectionSet->selections, 1)
                            )
                        );
                    }
                }
            }
        ];
    }
934925
public function get_contexts() : array {
        $contexts = [];
        foreach ($this->contextids as $contextid) {
            // It is possible that this context has been deleted and we now have subsequent calls being made with this
            // contextlist. Exceptions here will stop the further processing of this component and that is why we are
            // doing a try catch.
            try {
                $contexts[] = \context::instance_by_id($contextid);
            } catch (\Exception $e) {
                // Remove this context.
                unset($this->contextids[$this->iteratorposition]);
            }
        }

        return $contexts;
    }
336425
protected function getClientOptions()
    {
        $options = $this->clientOptions;
        $options['core']['multiple'] = $this->multiple;

        if ($this->items !== null)
            $options['core']['data'] = $this->items;

        return $options;
    }
1255192
public function DeleteContext(\Google\Cloud\Dialogflow\V2\DeleteContextRequest $argument,
      $metadata = [], $options = []) {
        return $this->_simpleRequest('/google.cloud.dialogflow.v2.Contexts/DeleteContext',
        $argument,
        ['\Google\Protobuf\GPBEmpty', 'decode'],
        $metadata, $options);
    }