Binds the current Input instance with the given arguments and options.

@throws InvalidPackageTemplateException
@throws TemplatePackageMissingException

@param InputDefinition $definition A InputDefinition instance
511032
public function bind(InputDefinition $definition)
    {
        $this->arguments = array();
        $this->options = array();
        $this->definition = $definition;

        $packageClass = $this->getPackageClass();

        $options = $packageClass::getOptions();
        $arguments = $packageClass::getArguments();

        foreach ($options as $option) {
            $this->definition->addOption(new InputOption(
                array_get($option, 0, null),
                array_get($option, 1, null),
                array_get($option, 2, null),
                array_get($option, 3, null),
                array_get($option, 4, null)
            ));
        }

        foreach ($arguments as $argument) {
            $this->definition->addArgument(new InputArgument(
                array_get($argument, 0, null),
                array_get($argument, 1, null),
                array_get($argument, 2, null),
                array_get($argument, 3, null)
            ));
        }

        $this->parse();

        if ((count($options) + count($arguments)) == 0 &&
            count($this->arguments) == 2
        ) {
            // The package does not define any arguments or options. We
            // will check to see if the user has not supplied all of
            // the required arguments specified by NewUp. If they
            // haven't, it is most like the install directory.
            // We will add that argument automatically here
            // to make general usage a little bit nicer.
            $this->arguments = array_merge($this->arguments, ['newup-output-directory' => '.']);
        }

    }
492969
public function bind(string $name, $definition)
    {
        $this->definitions[$name] = new Singleton($name, $definition);
        return $this;
    }
715396
public function compile($definition)
    {
        $validator = $this->createValidator($definition);
        $validator->validate($definition);

        $options = $definition->export();
        $expression = $options['expression'];
        unset($options['expression']);

        return new ExpressionPropertyValidator($expression, $options);
    }
705704
public function setData($definitions)
    {
        if (is_array($definitions)) {
            $this->parsedData = $definitions;
            return;
        }

        if (!is_file($definitions)) {
            throw new InvalidArgumentException(
                "The form definition file '{$definitions}' does not exists."
            );
        }

        try {
            $this->parsedData = include $definitions;
        } catch (\Exception $caught) {
            throw new ParserErrorException(
                'Error parsing form definitions: '.$caught->getMessage(),
                0,
                $caught
            );
        }
    }
1093803
public function createDictionary(DictionaryDefinition $definition): DictionaryInterface
    {
        $builder = $this->getDictionaryBuilder($definition);

        /** @var DictionaryBuilderInterface $builder */
        return $builder->build($this, $definition);
    }
242047
public function setDefinition($definition)
    {
        if ($definition instanceof Expression) {
            $definition = (string) $definition;
        }

        $this->definition = $definition;
    }
447908
private function getOptions(InputDefinition $definition, array $options): array
    {
        $argv = [];
        foreach ($options as $name => $value) {
            $definition->getOption($name) && $argv[] = sprintf('--%s=%s', $name, $value);
        }
        return $argv;
    }
365719
public function setDefinition($definition)
	{
		if ($definition instanceof InputDefinition)
		{
			$this->definition = $definition;
		}
		else
		{
			$this->definition->setDefinition($definition);
		}

		$this->applicationDefinitionMerged = false;
	}
131371
private function setDefinitionConfigurator(Definition $definition, array $array)
    {
        if (isset($array['configurator'])) {
            $configurator = $array['configurator'];
            if (is_array($configurator)) {
                $configurator[0] = $this->convertArgument($configurator[0]);
            }

            $definition->setConfigurator($configurator);
        }
    }
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);
        }
    }
446090
private function hydrateDefinitionArguments(Definition $definition, array &$definitionArray)
    {
        foreach ($definition->getArguments() as $arg) {
            $definitionArray['arguments'][] = $this->convertArgument($arg);
        }
    }
328667
private static function define($domainId, $definition) {
		$definition = ConfigHelper::normalizeItemConfig($domainId, $definition);
		if(!\App::$domain->has($domainId)) {
			\App::$domain->set($domainId, $definition);
		}
	}
967227
public function addContentItemDefinition(ContentItemDefinition $definition)
    {
        if (!is_string($definition->getMimeType())) {
            throw UnregisterableDefinitionException::notAStringMimeType($definition);
        }

        if (!in_array($definition->getMimeType(), ItemType::getList())) {
            throw UnregisterableDefinitionException::unsupportedMimeType($definition);
        }

        if ($this->has($definition->getMimeType())) {
            throw UnregisterableDefinitionException::duplicateMimeType($definition);
        }

        $this->definitions[$definition->getMimeType()] = $definition;
    }
535941
public function addCodeDefinition(CodeDefinition $definition)
    {
        $this->bbcodes[$definition->getTagName()][$definition->usesOption()] = $definition;
        return $this;
    }
777573
protected function _resolveDefinition(
        DefinitionInterface $definition, array $parameters = [])
    {
        $entryName = $definition->getName();
        $definitionResolver = $this->_getDefinitionResolver($definition);

        try {
            $value = $definitionResolver->resolve($definition, $parameters);
        } catch (\Exception $exception) {
            throw new DependencyException(
                "An error occurred while resolving " .
                "entry '{$entryName}': " . $exception->getMessage(),
                0,
                $exception
            );
        }

        return $value;
    }
990755
public function loadFromFieldset($definition)
	{
		if(!is_array($definition))
		{
			$definition = deserialize($definition, true);
		}

		$buttons  = array();
		$group    = false;
		$dropdown = false;

		foreach($definition as $button)
		{
			if($button['label'] == '' && $button['type'] != 'group')
			{
				continue;
			}

			// encode value
			if(isset($button['button']) && $button['button'] == 'link')
			{
				if (substr($button['value'], 0, 7) == 'mailto:')
				{
					$button['value'] = \String::encodeEmail($button['value']);
				}
				else
				{
					$button['value'] = ampersand($button['value']);
				}
			}

			if($dropdown !== false && ($button['type'] != 'child' && $button['type'] != 'header'))
			{
				if($group !== false)
				{
					$this->addItemToTarget($group['items'], $dropdown);
				}
				else
				{
					$this->addItem($dropdown);
				}

				$dropdown = false;
			}

			// create new group
			if($button['type'] == 'group')
			{
				$this->toolbar = true;

				if($dropdown !== false)
				{
					if($group)
					{
						$this->addItemToTarget($group['items'], $dropdown);
					}
					else
					{
						$this->addItem($dropdown);
					}

					$dropdown = false;
				}

				if($group !== false)
				{
					$this->addItem($group);
				}

				$group = $button;
				$group['items'] = array();
			}

			// create dropdown
			elseif($button['type'] == 'dropdown')
			{
				$dropdown = $button;
				$dropdown['items'] = array();
			}

			// add dropdown child
			elseif($button['type'] == 'child' || $button['type'] == 'header')
			{
				$dropdown['items'][] = $button;
			}

			// add button
			elseif($group !== false)
			{
				$this->addItemToTarget($group['items'], $button);
			}
			else
			{
				$this->addItem($button);
			}
		}

		if($group !== false)
		{
			if($dropdown !== false)
			{
				$this->addItemToTarget($group['items'], $dropdown);
			}

			$this->addItem($group);
		}
		elseif($dropdown !== false)
		{
			$this->addItem($dropdown);
		}
	}
1077971
public function registerProcessor(Definition $definition, $id)
    {
        if ($this->container->has($id)) {
            throw new InvalidConfigurationException('Processor id used twice: '.$id);
        }

        $this->container->setDefinition($id, $definition);
        $definition->setProperty('id', $id);

        return new Reference($id);
    }