Generates the context information to be logged.

@return array
329410
protected function getContextMessage()
    {
        $context = $this->context;

        if (($this->logUser === true) && ($user = \Yii::$app->get('user', false)) !== null) {
            /** @var \yii\web\User $user */
            $context['userId'] = $user->getId();
        }

        foreach ($this->logVars as $name) {
            if (empty($GLOBALS[$name]) === false) {
                $context[$name] = & $GLOBALS[$name];
            }
        }

        return $context;
    }
35703
protected function context()
    {
        try {
            return [
                'userId' => Auth::id(),
                'email' => Auth::user() ? Auth::user()->email : null
            ];
        } catch (Throwable $e) {
            return [];
        }
    }
883887
public function context()
    {
        $this->logger->debug('kernel.context: generate Context instance');

        $request = Request::globals();
        $response = new Response;
        return new Context($request, $response);
    }
763721
private function getResourceContext()
    {
        if (null === $this->httpProxy["host"] || null === $this->httpProxy["port"]) {
            return null;
        }

        $options = array();
        foreach (array("http", "https") as $protocol) {
            $options[$protocol] = array(
                "method"          => "GET",
                "proxy"           => sprintf("tcp://%s:%s", $this->httpProxy["host"], $this->httpProxy["port"]),
                "request_fulluri" => true
            );

            if (null !== $this->httpProxy["auth"]) {
                $options[$protocol]["header"] = sprintf("Proxy-Authorization: Basic %s", base64_encode($this->httpProxy["auth"]));
            }
        }

        return stream_context_create($options);
    }
432246
public function getMetaInfo()
    {
        if ($this->getAuthenticationDetails() instanceof AuthenticationDetails) {
            $authId     = $this->getAuthenticationDetails()->getAuthId();
            $authMethod = $this->getAuthenticationDetails()->getAuthMethod();
            $authRole   = $this->getAuthenticationDetails()->getAuthRole();
            $authRoles  = $this->getAuthenticationDetails()->getAuthRoles();
        } else {
            $authId     = 'anonymous';
            $authMethod = 'anonymous';
            $authRole   = 'anonymous';
            $authRoles  = [];
        }

        return [
            'realm'         => $this->getRealm()->getRealmName(),
            'authprovider'  => null,
            'authid'        => $authId,
            'authrole'      => $authRole,
            'authroles'     => $authRoles,
            'authmethod'    => $authMethod,
            'session'       => $this->getSessionId(),
            'role_features' => $this->getRoleFeatures()
        ];
    }
487447
public function getContext()
    {
        return array_filter(array(
            'subject' => $this->getSubject(),
            'from' => $this->addressToString((array) $this->getSender()),
            'to' => $this->addressToString((array) $this->getRecipients()),
            'cc' => $this->addressToString((array) $this->getCc()),
            'bcc' => $this->addressToString((array) $this->getBcc())
        ));
    }
721171
public function getContext()
    {

        if (is_null($this->context) && !is_null($this->contextId)) {
            $this->context = Context::fromRecordId($this->contextId, $this->getDataConnector());
        }

        return $this->context;

    }
822469
protected function streamContextArray()
    {
        return [
            'http' => [
                // direct connection properties
                'method'           => $this->method,
                'header'           => $this->header,
                'content'          => $this->content,
                'protocol_version' => $this->protocolVersion,

                // options
                'ignore_errors'    => $this->getOption('ignore_errors'),
                'follow_location'  => $this->getOption('max_redirects') > 0,
                'max_redirects'    => $this->getOption('max_redirects') + 1,
                'timeout'          => $this->timeout === -1 ? 30 : $this->timeout
            ],
            'ssl' => [
                'verify_peer' => $this->getOption('verify_peer'),
                'verify_host' => $this->getOption('verify_host'),
            ]
        ];

    }
970630
public static function getLogid(): string
    {
        $contextData = self::getCoroutineContext(self::DATA_KEY);
        $logid = $contextData['logid'] ?? '';
        return $logid;
    }
153394
public function getData(): array
    {
        return [
            $this->serverOriginScheme,
            $this->serverOriginHost,
            $this->serverOriginPort,
            $this->isPreFlightCanBeCached,
            $this->preFlightCacheMaxAge,
            $this->isForceAddMethods,
            $this->isForceAddHeaders,
            $this->isUseCredentials,
            $this->areAllOriginsAllowed,
            $this->allowedOrigins,
            $this->areAllMethodsAllowed,
            $this->allowedLcMethods,
            $this->allowedMethodsList,
            $this->areAllHeadersAllowed,
            $this->allowedLcHeaders,
            $this->allowedHeadersList,
            $this->exposedHeadersList,
            $this->isCheckHost,
        ];
    }
245664
protected function getContext()
	{
		$context=array();
		if($this->logUser && ($user=Yii::app()->getComponent('user',false))!==null)
			$context[]='User: '.$user->getName().' (ID: '.$user->getId().')';

		if($this->dumper==='var_export' || $this->dumper==='print_r')
		{
			foreach($this->logVars as $name)
				if(($value=$this->getGlobalsValue($name))!==null)
					$context[]="\${$name}=".call_user_func($this->dumper,$value,true);
		}
		else
		{
			foreach($this->logVars as $name)
				if(($value=$this->getGlobalsValue($name))!==null)
					$context[]="\${$name}=".call_user_func($this->dumper,$value);
		}

		return implode("\n\n",$context);
	}
1091114
protected function context()
    {
        return collect($this->option())->only([
            'ansi',
            'no-ansi',
            'no-interaction',
            'quiet',
            'verbose',
        ])->filter()->mapWithKeys(function ($value, $key) {
            return ["--{$key}" => $value];
        })->all();
    }
558285
public static function getContext()
    {
        $coID = Coroutine::getuid();
        if(!isset(static::$context[$coID]))
        {
            throw new \RuntimeException('get context failed, current context is not found');
        }
        return static::$context[$coID];
    }
303242
public function info()
    {
        return [
            'gerrit' => [
                'hostUri' => $this->hostUri,
                'gerritProject' => $this->gerritProject,
                'revisionId' => $this->revisionId,
                'aliasContext' => $this->aliasContext->info()
            ]
        ];
    }
571485
public function getContext()
    {
        $context = new KViewContextTemplate();
        $context->setSubject($this);
        $context->setData($this->_data);
        $context->setLayout($this->getLayout());

        return $context;
    }
124648
protected function getContext(): array
	{
		if($this->app->isCommandLine() === false && $this->container->has(Gatekeeper::class))
		{
			$user = $this->container->get(Gatekeeper::class)->getUser();

			return ['user_id' => $user !== null ? $user->getId() : null];
		}

		return [];
	}
1227355
public function get_child_contexts() {
        global $DB;

        if (empty($this->_path) or empty($this->_depth)) {
            debugging('Can not find child contexts of context '.$this->_id.' try rebuilding of context paths');
            return array();
        }

        $sql = "SELECT ctx.*
                  FROM {context} ctx
                 WHERE ctx.path LIKE ? AND (ctx.depth = ? OR ctx.contextlevel = ?)";
        $params = array($this->_path.'/%', $this->depth+1, CONTEXT_COURSECAT);
        $records = $DB->get_records_sql($sql, $params);

        $result = array();
        foreach ($records as $record) {
            $result[$record->id] = context::create_instance_from_record($record);
        }

        return $result;
    }