Loads the specified context.

Contexts may be used by accessing the context directly.

@param string $context name of the context or full class name that
defines the context

@throws LoaderException if the specified context doesn't exist
18330
public static function load($context = '')
    {
        if (empty($context)) {
            $context = self::$defaultContext;
        }
        if ($context[0] !== '\\') {
            // Short context name (must be formatted into class name).
            $context = self::$contextPrefix . $context;
        }
        if (! class_exists($context)) {
            throw @new LoaderException(
                'Specified context ("' . $context . '") does not exist.',
                $context
            );
        }
        self::$loadedContext = $context;
        self::$KEYWORDS = $context::$KEYWORDS;
    }
353012
public function loadAllObjects(LoadingContext $context, array $rows) : array
    {
        $objects = [];

        foreach ($rows as $key => $row) {
            $objects[$key] = $this->constructNewObjectFromRow($row);
        }

        $this->loadAll($context, $objects, $rows);

        return $objects;
    }
334933
public void setThreadContextLoader() {
        if (isContextLoaderSaved) {
            throw new BuildException("Context loader has not been reset");
        }
        if (LoaderUtils.isContextLoaderAvailable()) {
            savedContextLoader = LoaderUtils.getContextClassLoader();
            ClassLoader loader = this;
            if (project != null && "only".equals(project.getProperty("build.sysclasspath"))) {
                loader = this.getClass().getClassLoader();
            }
            LoaderUtils.setContextClassLoader(loader);
            isContextLoaderSaved = true;
        }
    }
413294
public function run($context)
    {
        foreach ($this->actions as $step) {
            /** @var $step Action  **/
            codecept_debug("- $step");
            try {
                call_user_func_array([$context, $step->getAction()], $step->getArguments());
            } catch (\Exception $e) {
                $class = get_class($e); // rethrow exception for a specific action
                throw new $class($e->getMessage() . "\nat $step");
            }
        }
    }
371286
public function apply( $context ) {
		if ( ! $context instanceof RContext ) {
			$context = new Context( $context );
		}

		return $this->evaluate( $context );
	}
877176
protected final void setContext(@NonNull final Context context) {
        Condition.INSTANCE.ensureNotNull(context, "The context may not be null");
        this.context = context;
    }
496443
public function setActiveContext($context)
    {
        $oldLocale = isset($this->activeContext) ? $this->contextLocales[$this->activeContext] : null;
        $this->activeContext = $context;
        if (!isset($this->contextLocales[$context])) {
            $this->setContextLocale($context, static::BASE_LOCALE);
        }
        $newLocale = $this->contextLocales[$context];
        if ($newLocale !== $oldLocale) {
            $this->currentLocaleChanged($newLocale);
        }
    }
1001834
public static function load($source)
    {
        self::$variables = is_array($source) ? $source : require $source;
        self::$isLoaded = true;

        self::checkRequiredVariables();
    }
976062
public function execute(ServerContextInterface $context = null)
    {
        if (null === $context) {
            $context = new ServerContext();
        }

        $this->logServerStart($context);

        $this->server->start(
            $context,
            $this->decorateRequestHandler($this->requestHandler)
        );
    }
383700
public function initialize(ContextInterface $context)
    {
        $context->setDatabase($this->databaseName);
        $context->setAjaxSteps($this->ajaxSteps);
        $context->setAjaxTimeout($this->ajaxTimeout);
        $context->setScreenshotPath($this->screenshotPath);
        $context->setRegionMap($this->regionMap);
        $context->setAdminUrl($this->adminUrl);
        $context->setLoginUrl($this->loginUrl);
    }
602757
public function loadClass($class)
    {
        if (array_key_exists($class, $aliases = $this->classAliasList->getRegisteredAliases())) {
            // we have an alias for it, but we don't have it yet loaded
            // (because after all, we're in the auto loader.)
            $fullClass = $aliases[$class];
            if (!class_exists($fullClass, false)) {
                spl_autoload_call($fullClass);
            }
            // finally, we set up a class alias for this list. We do this now because
            // we don't know earlier what namespace it'll be in
            class_alias($fullClass, $class);
        }
    }
675065
public function set_context($context) {
        if ($context === null) {
            // Extremely ugly hack which sets context to some value in order to prevent warnings,
            // use only for core error handling!!!!
            if (!$this->_context) {
                $this->_context = context_system::instance();
            }
            return;
        }
        // Ideally we should set context only once.
        if (isset($this->_context) && $context->id !== $this->_context->id) {
            $current = $this->_context->contextlevel;
            if ($current == CONTEXT_SYSTEM or $current == CONTEXT_COURSE) {
                // Hmm - not ideal, but it might produce too many warnings due to the design of require_login.
            } else if ($current == CONTEXT_MODULE and ($parentcontext = $context->get_parent_context()) and
                $this->_context->id == $parentcontext->id) {
                // Hmm - most probably somebody did require_login() and after that set the block context.
            } else {
                // We do not want devs to do weird switching of context levels on the fly because we might have used
                // the context already such as in text filter in page title.
                debugging("Coding problem: unsupported modification of PAGE->context from {$current} to {$context->contextlevel}");
            }
        }

        $this->_context = $context;
    }
209225
public function initialization(&$context)
    {
        $this->setContext($context);
        $this->redis = $this->loader->redis("redisPool",$this);
        $this->db = $this->loader->mysql("mysqlPool",$this);
    }
1046788
public static function load($mode)
    {
		if (!is_string($mode)){
			throw new InvalidArgumentException('Try to load an irregular mode in the context. The mode must be a string, ' . gettype($mode) . ' given.');
		}
    	else if (empty($mode)){
    		throw new InvalidArgumentException('Cannot load an empty mode in the context.');
    	}
    	
    	if(!in_array($mode, self::$current)){
    		self::$current[] = $mode;
    	}
    }
1171164
private function initializeInstance(Context $context)
    {
        foreach ($this->contextInitializers as $initializer) {
            $initializer->initializeContext($context);
        }
    }
993480
protected function setContext($context = null)
    {
        if ($context) {
            $this->context = new LogContext($this->parser, $context);
        }
    }
1191481
public function load($source, $context)
    {
        $key = $this->getSpecificSourceCacheKey(
            $source,
            $context
        );

        if (isset($this->commentTree[$key]) && is_array($this->commentTree[$key])) {
            return $this->commentTree[$key];
        }

        /**
         * Fetch key from cache.
         */
        $commentTree = $this->loadCommentTreeFromCache($source, $context);

        /**
         * If cache key is empty, build it.
         */
        if (empty($commentTree)) {
            $commentTree = $this->buildCommentTreeAndSaveIntoCache($source, $context);
        }

        $this->commentTree[$key] = $commentTree;

        return $commentTree;
    }