@param $definitions
@param array $context

@throws InvalidConfigurationException
761073
public function define(array $definitions, array &$context)
    {
        if (!is_array($definitions)) {
            throw new InvalidConfigurationException(
                "Step 'define' in AbstractConfigurableProducer expected an array as configuration"
            );
        }

        if (!array_key_exists(self::CONTEXT_VARS, $context)) {
            $context[self::CONTEXT_VARS] = [];
        }

        foreach ($definitions as $key => $definition) {
            $context[self::CONTEXT_VARS][$key] = $this->resolve($definition, $context);
        }
    }
769435
public function validateProviders(array $providers) : void
    {
        Assert::allClassExists($providers);
        Assert::allImplementsInterface($providers, self::PROVIDER_INTERFACE);

        foreach ($this->requiredProviders as $name) {
            if (!in_array($name, array_keys($providers))) {
                throw new InvalidArgumentException("Configuration is missing a required provider for [$name]");
            }
        }
    }
41124
private function setDefinitionArguments(Definition $definition, array $array)
    {
        if (true === array_key_exists('arguments', $array)) {
            foreach ($array['arguments'] as $arg) {
                $definition->addArgument($this->convertArgument($arg));
            }
        }
    }
458874
private function setConfig(UserContext $context, array $config)
    {
        $this->domainName = $config['domain'];

        // Determine owner
        if ($config['username'] === $context->getUsername()) {
            $this->owner = $context->getContextUser();
        } else {
            throw new DirectAdminException('Could not determine relationship between context user and domain');
        }

        // Parse plain options
        $bandwidths = array_map('trim', explode('/', $config['bandwidth']));
        $this->bandwidthUsed = floatval($bandwidths[0]);
        $this->bandwidthLimit = !isset($bandwidths[1]) || ctype_alpha($bandwidths[1]) ? null : floatval($bandwidths[1]);
        $this->diskUsage = floatval($config['quota']);

        $this->aliases = array_filter(explode('|', $config['alias_pointers']));
        $this->pointers = array_filter(explode('|', $config['pointers']));
    }
936549
protected function assimilateContext(array $context = [])
    {
        $this->_context_ = $context;
        foreach ($context as $key => $value) {
            $this->$key = $value;
        }
    }
109510
public function init()
    {
        if ($this->dataProvider === null) {
            throw new InvalidConfigException('The "dataProvider" property must be set.');
        }
        if ($this->emptyText === null) {
            $this->emptyText = Yii::t('yii', 'No results found.');
        }
        if (!isset($this->options['id'])) {
            $this->options['id'] = $this->getId();
        }

        if ($this->formatter == null) {
            $this->formatter = Yii::$app->getFormatter();
        } elseif (is_array($this->formatter)) {
            $this->formatter = Yii::createObject($this->formatter);
        }
        if (!$this->formatter instanceof Formatter) {
            throw new InvalidConfigException('The "formatter" property must be either a Format object or a configuration array.');
        }

        if (!$this->keyColumnName) {
            throw new InvalidConfigException('The "keyColumnName" property must be specified"');
        }
        if (!$this->parentColumnName) {
            throw new InvalidConfigException('The "parentColumnName" property must be specified"');
        }

        $this->initColumns();
    }
365719
public function setDefinition($definition)
	{
		if ($definition instanceof InputDefinition)
		{
			$this->definition = $definition;
		}
		else
		{
			$this->definition->setDefinition($definition);
		}

		$this->applicationDefinitionMerged = false;
	}
109034
static public function formatName($definition)
	{
	    if (is_string($definition)) {
	        return $definition;
	    } elseif (is_object($definition)) {
	        return get_class($definition);
	    } elseif (is_array($definition)) {
	        if (!isset($definition['class'])) {
	            $name = $definition[0];
	        } else {
	            $name = $definition['class'];
	        }
	    } else {
	        throw new InvalidConfigException("Unsupported definition for :" . gettype($definition));
	    }
	}
144845
public function initializeContext(Context $context)
    {
        if ($context instanceof ResourceContext) {
            $reflector = new ReflectionClass(get_class($context));

            if ($this->builder->getLoader() instanceof FileResourceLoader) {
                if ($this->builder->getLoader()->getBasePath() == null) {
                    $this->builder->getLoader()->setBasePath(dirname($reflector->getFileName()));
                }
            }

            if ($context->getResourceFactory()) {
                $this->builder->setFactory($context->getResourceFactory());
            }

            $context->setResourceBuilder($this->builder);
        }
    }
596747
private static function parseDefinitions(array $definitions): array
    {
        if (\count($definitions) === 0) {
            return $definitions;
        }

        return \array_map(
            function ($definition) {
                if (\is_array($definition)) {
                    return $definition;
                }

                return self::loadDefinitionsFromPath($definition);
            },
            $definitions
        );
    }
1250055
public function addContext(Context $context) {
    $contexts = $this->get('contextOut');
    $contexts[] = $context;
    $this->add('contextOut', $contexts);
  }
148783
public function registerItinerary(Definition $definition, $name)
    {
        $id = self::ITINERARY_ID_PREFIX.'v'.$this->currentLoadingVersion.'.'.$name;

        // Avoid name duplicities
        if (in_array($id, $this->registeredNames)) {
            throw new InvalidConfigurationException('Itinerary name used twice: '.$id);
        }
        $this->registeredNames[] = $id;

        $this->container->setDefinition($id, $definition);
        $definition->setProperty('id', $id);
        $definition->setArguments([$name]);

        return new Reference($id);
    }
1286976
public static function reload(array $definitions = [])
    {
        $properties           = self::getProperties();
        $workerDefinitions    = self::getWorkerDefinition();
        $definitions          = ArrayHelper::merge($workerDefinitions, $definitions);

        self::$container->setProperties($properties);
        self::$container->addDefinitions($definitions);
        self::$container->autoloadWorkerAnnotation();

        $componentDefinitions = self::getComponentDefinitions();
        self::$container->addDefinitions($componentDefinitions);

        /* @var Aop $aop Init reload AOP */
        $aop = App::getBean(Aop::class);
        $aop->init();

        self::$container->initBeans();
    }
662223
public function setContext(array $context)
    {
        $this->clearContext();
        foreach ($context as $key => $value) {
            $this->setContextValue($key, $value);
        }
    }
1051904
public function resolve(
        DefinitionInterface $definition, array $parameters = [])
    {
        /** @var CallableDefinition $definition */
        $args = (empty($parameters)) ? $definition->getArgs(): $parameters;
        return call_user_func_array($definition->getCallable(), $args);
    }
791336
public function bind(InputDefinition $definition)
    {
        $hasCodeArgument = false;

        if ($definition->getArgumentCount() > 0) {
            $args    = $definition->getArguments();
            $lastArg = \array_pop($args);
            foreach ($args as $arg) {
                if ($arg instanceof CodeArgument) {
                    $msg = \sprintf('Unexpected CodeArgument before the final position: %s', $arg->getName());
                    throw new \InvalidArgumentException($msg);
                }
            }

            if ($lastArg instanceof CodeArgument) {
                $hasCodeArgument = true;
            }
        }

        $this->hasCodeArgument = $hasCodeArgument;

        return parent::bind($definition);
    }
73458
protected function setDefinition($id, Definition $definition)
    {
        $this->container->removeBindings($id);

        if ($this->isLoadingInstanceof) {
            if (!$definition instanceof ChildDefinition) {
                throw new InvalidArgumentException(sprintf('Invalid type definition "%s": ChildDefinition expected, "%s" given.', $id, \get_class($definition)));
            }
            $this->instanceof[$id] = $definition;
        } else {
            $this->container->setDefinition($id, $definition instanceof ChildDefinition ? $definition : $definition->setInstanceofConditionals($this->instanceof));
        }
    }