Create a WURFL_UserAgentHandlerChain from the given $context
@param WURFL_Context $context
@return WURFL_UserAgentHandlerChain
9865
public static function createFrom(WURFL_Context $context)
    {
        $cached_data = $context->cacheProvider->load('UserAgentHandlerChain');
        if ($cached_data !== null) {
            self::$_userAgentHandlerChain = $cached_data;
            foreach (self::$_userAgentHandlerChain->getHandlers() as $handler) {
                $handler->setupContext($context);
            }
        }
        if (!(self::$_userAgentHandlerChain instanceof WURFL_UserAgentHandlerChain)) {
            self::init($context);
            $context->cacheProvider->save('UserAgentHandlerChain', self::$_userAgentHandlerChain, 3600);
        }
        return self::$_userAgentHandlerChain;
    }
326778
public function fetchEntity(AnCommandContext $context)
    {
        if ($this->isDispatched()) {
            $username = $this->getRequest()->username;
            if ($username && $this->getRequest()->get('layout') != 'add') {
                $this->setIdentifiableKey('username');
            }
        }

        return parent::fetchEntity($context);
    }
689445
public function get_users_in_context(\context $context) : \core_privacy\local\request\userlist_collection {
        $progress = static::get_log_tracer();

        $components = $this->get_component_list();
        $a = (object) [
            'total' => count($components),
            'progress' => 0,
            'component' => '',
            'datetime' => userdate(time()),
        ];
        $collection = new \core_privacy\local\request\userlist_collection($context);

        $progress->output(get_string('trace:fetchcomponents', 'core_privacy', $a), 1);
        foreach ($components as $component) {
            $a->component = $component;
            $a->progress++;
            $a->datetime = userdate(time());
            $progress->output(get_string('trace:preprocessingcomponent', 'core_privacy', $a), 2);
            $userlist = new local\request\userlist($context, $component);

            $this->handled_component_class_callback($component, core_userlist_provider::class, 'get_users_in_context', [$userlist]);

            // Add contexts that the component may not know about.
            \core_privacy\local\request\helper::add_shared_users_to_userlist($userlist);

            if (count($userlist)) {
                $collection->add_userlist($userlist);
            }
        }
        $progress->output(get_string('trace:done', 'core_privacy'), 1);

        return $collection;
    }
785117
protected function _authorizeSubscribe($context)
    {
        $entity = $this->_entity;

        if ($this->_viewer->guest()) {
            return false;
        }

        if (!$entity->isSubscribable()) {
            return false;
        }

        //if the owner has blocked the viewer or the other way around, return false

        if ($this->_entity->isOwnable()) {
            if ($this->_entity->owner->blocking($this->_viewer) || $this->_viewer->blocking($this->_entity->owner)) {
                return false;
            }
        }

        //if already subscribed to the node then return false
        if ($entity->subscribed($this->_viewer)) {
            return false;
        }

        return true;
    }
651689
public function proceed(Context $context)
    {
        $context = $this->route($context);
        $context = $this->resolve($context);
        $context = $this->guard($context);
        $context = $this->execute($context);
        $context = $this->render($context);

        return $context;
    }
139690
protected function _actionTokenlogin(AnCommandContext $context)
    {
        if ($this->token == '') {
            throw new AnErrorException(array('No token is provided'), AnHttpResponse::FORBIDDEN);
        }

        $person = $this->getService('repos:people.person')->find(array('activationCode' => $this->token));

        if (! $person) {
            throw new AnErrorException(array('This token is invalid'), AnHttpResponse::NOT_FOUND);
        }

        $newPerson = ($person->registrationDate->compare($person->lastVisitDate)) ? true : false;

        if ($newPerson) {
            $person->enable();
        }

        $person->activationCode = '';
        $this->token = '';
        $this->_request->token = '';

        if ($this->reset_password) {
            AnRequest::set('session.reset_password_prompt', 1);
        }

        $credentials = array(
            'username' => $person->username,
            'password' => $person->password
        );

        dispatch_plugin('user.onBeforeLoginPerson', array('credentials' => $credentials));

        $this->getService('com:people.helper.person')->login($credentials);

        dispatch_plugin('user.onAfterLoginPerson', array('person' => $person));

        if ($this->return) {
            AnRequest::set('session.return', $this->return);
            $returnUrl = base64UrlDecode($this->return);
            $this->getResponse()->setRedirect($returnUrl);
        } else {
            unset($_SESSION['return']);
            if ($this->_request->isFirstPerson) {
                $this->setMessage(sprintf(translate('COM-PEOPLE-PROMPT-WELCOME-SUPERADMIN'), $person->name));
            } else {
                $this->setMessage('COM-PEOPLE-PROMPT-UPDATE-PASSWORD');
            }
            $this->getResponse()->setRedirect(route($person->getURL().'&get=settings&edit=account'));
        }

        $this->getResponse()->status = AnHttpResponse::ACCEPTED;

        return true;
    }
1283686
public function signResponse(KDispatcherContextInterface $context)
    {
        if(!$context->response->isError())
        {
            $token = $context->user->getSession()->getToken();

            $context->response->headers->addCookie($this->getObject('lib:http.cookie', array(
                'name'   => 'csrf_token',
                'value'  => $token,
                'path'   => $context->request->getBaseUrl()->getPath(),
            )));

            $context->response->headers->set('X-CSRF-Token', $token);
        }
    }
493907
protected function setFrontendUserAspect(Context $context, AbstractUserAuthentication $user)
    {
        $context->setAspect('frontend.user', GeneralUtility::makeInstance(UserAspect::class, $user));
    }
581337
public static function Create( $context, $node )
	{
		if ( is_a( $node, __CLASS__ ) )
		{
			/**
			 * @var PathStep $res
			 */
			$res = $node;
			return $res;
		}

		if ( $node instanceof PathExprNode )
		{
			/**
			 * @var PathExprNode $pathExpr
			 */
			$pathExpr = $node;
			return $pathExpr->FirstStep;
		}

		return PathStep::fromNode( AbstractNode::Create( $context, $node ) );
	}
1235748
protected function before(Context $context)
    {
        // set context forwarder
        $context->forwarder = $context->forwarder ?: [$this, 'forward'];

        return parent::before($context);
    }
809839
public function create($context = null)
    {
        try {
            $this->context = strlen($context) ? $context : $this->getConfig('create[context]', self::CONTEXT_CREATE);
            $this->controller->pageTitle = $this->controller->pageTitle ?: $this->getLang(
                "{$this->context}[title]",
                'backend::lang.form.create_title'
            );

            $model = $this->controller->formCreateModelObject();
            $model = $this->controller->formExtendModel($model) ?: $model;

            $this->initForm($model);
        }
        catch (Exception $ex) {
            $this->controller->handleError($ex);
        }
    }
1299677
protected function _actionOauthorize($context)
    {
        $data = $context->data;
        AnRequest::set('session.return', (string) $data->return);
        AnRequest::set('session.oauth', null);
        $view = $this->_mixer->getIdentifier()->name;
        $this->getAPI()->setToken(null);
        $context->response->setRedirect($this->getAPI()->getAuthorizationURL());
    }
134988
public function getContext(ModelContextInterface $context = null)
    {
        $context = new ModelContext($context);
        $context->setState($this->getState());
        $context->setIdentityKey($this->_identity_key);

        return $context;
    }
310075
public function spanContext()
    {
        $context = Context::current();
        return new SpanContext(
            $context->value('traceId'),
            $context->value('spanId'),
            $context->value('enabled'),
            $context->value('fromHeader')
        );
    }
307636
public function bindContext($context, Request $request)
    {
        $security = $this->getSecurity($context);

        $this->container->instance(SecurityApi::class, $security);

        $this->container->bind(UrlGeneratorContract::class, function() use ($security){
            return $security->url();
        });

        $this->container->bind(UrlGenerator::class, function(Container $container) use ($security){
            /** @var PermissionAwareUrlGeneratorExtension $url */
            $url = $container->make(PermissionAwareUrlGeneratorExtension::class);
            $url->setUrlGenerator($security->url());

            return $url;
        });

        $this->container->alias(UrlGenerator::class, 'url');

        $request->setUserResolver(function() use ($security){
            return $security->getUser();
        });
    }
869253
public function getDBQueryBuilder(Context $context = null)
    {
        if ($this->dbQueryBuilder == null) {
            $this->dbQueryBuilder            = new Miner();
        }
        $this->dbQueryBuilder->context = $context;

        return $this->dbQueryBuilder;
    }
1364686
public static function Create( $context, $value )
	{
		if ( $value instanceof PathStep )
		{
			return new PathExprNode( $context, $value );
		}

		if ( $value instanceof AbstractNode )
		{
			return $value;
		}

		return new ValueNode( $context, $value );
	}