Registers context class.

@param string     $contextClass
@param null|array $arguments

@throws ContextNotFoundException   If class does not exist
@throws WrongContextClassException if class does not implement Context interface
176088
public function registerContextClass($contextClass, array $arguments = null)
    {
        if (!class_exists($contextClass)) {
            throw new ContextNotFoundException(sprintf(
                '`%s` context class not found and can not be used.',
                $contextClass
            ), $contextClass);
        }

        $reflClass = new \ReflectionClass($contextClass);

        if (!$reflClass->implementsInterface('Behat\Behat\Context\Context')) {
            throw new WrongContextClassException(sprintf(
                'Every context class must implement Behat Context interface, but `%s` does not.',
                $contextClass
            ), $contextClass);
        }

        $this->contextClasses[$contextClass] = $arguments ? : array();
    }
834864
public function setContextualClass($class)
    {
        $class = strtolower($class);
        $this->contextualClass = $class;

        if (property_exists($this, 'contextualClassColorMap')) {
            if (array_key_exists($class, $this->contextualClassColorMap)) {
                $this->setColor(new Color($this->contextualClassColorMap[ $class ]));
            }
        }

        return $this;
    }
778646
public function initializeContext(Context $context)
    {
        if (false === $context instanceof AliceContextInterface) {
            return;
        }

        /* @var AliceContextInterface $context */
        $fixturesBasePath = $this->fixturesBasePath;
        switch (true) {

            case $context instanceof AliceODMContext:
                $fixturesBasePath .= '/ODM';
                break;

            case $context instanceof AliceORMContext:
                $fixturesBasePath .= '/ORM';
                break;

            case $context instanceof AlicePHPCRContext:
                $fixturesBasePath .= '/PHPCR';
                break;
        }

        if (null === $context->getBasePath()) {
            $context->setBasePath($fixturesBasePath);
        }
    }
215787
private function registerAnnotation($class)
    {
        /** @var CustomField $annotation */
        if ($annotation = $this->annotationReader->getClassAnnotation(
            new \ReflectionClass($class),
            'Lullabot\Mpx\DataService\Annotation\CustomField'
        )) {
            if (!is_subclass_of($class, CustomFieldInterface::class)) {
                throw new \RuntimeException(sprintf('%s must implement %s.', $class, CustomFieldInterface::class));
            }

            $this->customFields[$annotation->service][$annotation->objectType][$annotation->namespace] = new DiscoveredCustomField(
                $class, $annotation
            );
        }
    }
877176
protected final void setContext(@NonNull final Context context) {
        Condition.INSTANCE.ensureNotNull(context, "The context may not be null");
        this.context = context;
    }
953069
public function register($commandClassName, CommandHandlerInterface $commandHandler)
    {
        $this->assertNamingConventionSatisfied($commandClassName, get_class($commandHandler));
        $this->assertImplementsCommandInterface($commandClassName);

        if ($this->isCommandRegistered($commandClassName)) {
            throw new InvalidArgumentException(
                sprintf(
                    'A command handler has already been defined for the command "%s". Previous handler: %s. New handler: %s',
                    $commandClassName,
                    get_class($this->handlers[strtolower($commandClassName)]),
                    get_class($commandHandler)
                )
            );
        }
        $this->handlers[strtolower($commandClassName)] = $commandHandler;
    }
848502
public static ApplicationContext run(Class cls, String... args) {
        return run(new Class[]{cls}, args);
    }
1284918
private function createContextDirectory($path)
    {
        mkdir($path, 0777, true);

        if ($this->logger) {
            $this->logger->directoryCreated($path, 'place your context classes here');
        }
    }
301413
public function Invoke( $context, $provider, $args )
	{
		return is_null( $this->Delegate )
			? null
			: call_user_func( $this->Delegate, $context, $provider, $args );
	}
263923
public static function registerAdminClass(string $name, string $class): bool
    {
        if (class_exists($class) === false) {
            return false;
        }
        if (self::$admin_classes === null) {
            self::$admin_classes = [];
        }
        $check = new ReflectionClass($class);
        if ($check->implementsInterface("TheCMSThread\\Classes\\Admin") === true) {
            self::$admin_classes[$name] = $class;
            return true;
        } else {
            return false;
        }
    }
300585
public void setContext(Context context) {
        context.put(JavacElements.class, this);
        javaCompiler = JavaCompiler.instance(context);
        syms = Symtab.instance(context);
        names = Names.instance(context);
        types = Types.instance(context);
        enter = Enter.instance(context);
    }
1098983
public function getContext(string $class): Context
    {
        if (!isset($this->contexts[$class])) {
            throw new ContextNotFoundException(sprintf(
                '`%s` context is not found in the suite environment. Have you registered it?',
                $class
            ), $class);
        }

        return $this->contexts[$class];
    }
856825
public function registerCall($name, array $arguments = [])
    {
        $name = strtolower(preg_replace("/([A-Z]{1})/", "_$0", $name));

        $this->calls = array_merge($this->calls, array_filter(explode("_", $name)));

        if (count($arguments) > 0) {
            $lastIndex = count($this->calls) - 1;

            $this->calls[$lastIndex] = [$this->calls[$lastIndex], $arguments];
        }
    }
800237
public function register( $args = [ ] ) {
		foreach ( $this->getConfigKeys() as $slug ) {

			if ( $this->isReservedTerm( $slug ) ) {
				throw new ReservedTermException( $slug );
			}

			if ( static::DEFAULTS === $slug ) {
				continue;
			}

			$argsCollection = $this->prepareArguments( $slug, (array) $args );
			$this->doRegistration( $slug, $argsCollection );
		}
	}
641480
protected function logInfo(string $message, array $context = []): void
    {
        if ($this->logger !== null) {
            $this->logger->info($message, $context);
        }
    }
223707
public function initialize(AgaviContext $context, array $parameters = array())
	{
		parent::initialize($context, $parameters);

		$this->plugin_dir = $this->getParameter('plugin_dir', $this->plugin_dir);
	}
738258
public function setContext($context)
    {
        if ($context === self::CONTEXT_APP || $context === self::CONTEXT_USER) {
            $this->context = $context;
        } else {
            throw new InvalidArgumentException('Incorrect context');
        }
    }