Set the definition tags into definition object if it exists.

@param Definition $definition definition object to hydrate
@param array      $array      raw definition datas
763251
private function setDefinitionTags(Definition $definition, array $array)
    {
        if (isset($array['tags'])) {
            if (!is_array($array['tags'])) {
                throw new InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s".', $id));
            }

            foreach ($array['tags'] as $tag) {
                if (!isset($tag['name'])) {
                    throw new InvalidArgumentException(sprintf(
                        'A "tags" entry is missing a "name" key for service "%s".',
                        $id
                    ));
                }

                $name = $tag['name'];
                unset($tag['name']);

                foreach ($tag as $attribute => $value) {
                    if (!is_scalar($value)) {
                        throw new InvalidArgumentException(sprintf(
                            'A "tags" attribute must be of a scalar-type for service "%s", tag "%s".',
                            $id,
                            $name
                        ));
                    }
                }

                $definition->addTag($name, $tag);
            }
        }
    }
1250187
protected function buildSortedMap(array $definition) {
		$sortArgs = [];
		
		foreach ($definition as $definitionPart) {
			list($property, $direction) = $this->parseSortDefinition($definitionPart);
			
			$sortArgs[] = $this->getDataColumn($property);
			$sortArgs[] = $direction;
		}
		
		$this->_map = array_keys($this->_data);
		$sortArgs[] = &$this->_map;
		
		call_user_func_array('array_multisort', $sortArgs);
	}
731199
public function setStaticDefinition($id, \Closure $definition, $tags = [])
    {
        $this->setDefinition($id, function ($container) use ($definition) {
            static $instance;
            if (!isset($instance)) {
                $instance = $definition($container);
            }

            return $instance;
        }, $tags);
    }
1356587
public function copyFromArray(array &$array)
    {
        // subject
        $this->setSubject(
            LanguageUtility::getFromArray('subject', $array));

        // developer
        $this->setDeveloper(
            LanguageUtility::getFromArray('developer', $array));

        // start
        $this->setStart(
            LanguageUtility::parseInteger(
                getFromArray('start', $array)));

        // end
        $this->setEnd(
            LanguageUtility::parseInteger(
                getFromArray('end', $array)));
    }
466840
private function configureConsumer(Definition $definition, array $tag, array $references)
    {
        if (isset($tag['method'])) {

            if (isset($tag['bulk']) && $tag['bulk']) {
                $definition->addMethodCall($tag['method'], array($references));
            } else {
                foreach ($references as $name => $service) {
                    $definition->addMethodCall($tag['method'], array($service, $name));
                }
            }

        } else {

            if (isset($tag['bulk']) && !$tag['bulk']) {
                foreach ($references as $service) {
                    $definition->addArgument($service);
                }
            } else {
                $definition->addArgument($references);
            }
        }
    }
158263
public static function addOptions(InputDefinition $definition, array $fields, $description)
    {
        foreach ($fields as $field => $type) {
            $mode = 'array' === $type
                ? InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY
                : InputOption::VALUE_REQUIRED;

            if (!$definition->hasOption($field) && !$definition->hasArgument($field)) {
                $definition->addOption(new InputOption($field, null, $mode, sprintf($description, $field, $type)));
            }
        }
    }
914386
public function copyToArray(array &$array)
    {
        parent::copyToArray($array);

        $array['action']               = LanguageUtility::toString($this->action);
        $array['accessToken']          = $this->accessToken;
        $array['accessTokenExpiresAt'] = LanguageUtility::orZero($this->accessTokenExpiresAt);
        $array['scopes']               = $this->scopes;
        $array['properties']           = LanguageUtility::convertArrayOfArrayCopyableToArray($this->properties);
    }
855206
private function extendContainer($tag, Definition $definition, $identifier = '')
    {
        if ('' !== $identifier) {
            $identifier .= '.';
        }

        $this->container
          ->setDefinition("$this->configKey.$identifier$tag", $definition)
          ->addTag($tag);
    }
520336
private function hydrateDefinitionFileProperty(Definition $definition, array &$definitionArray)
    {
        if (null !== $definition->getFile()) {
            $definitionArray['file'] = $definition->getFile();
        }
    }
361185
protected function fromArray(array $definition)
    {
        $definition += $this->defaultDefinition;

        $refClass = new ReflectionClass($definition['class']);
        $instance = $refClass->newInstanceArgs(self::parseArguments($definition['arguments']));

        foreach ($definition['call'] as $methodName => $args) {
            $refMethod = new ReflectionMethod($instance, $methodName);
            $refMethod->invokeArgs($instance, self::parseArguments($args));
        }

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

		$this->applicationDefinitionMerged = false;
	}
1241702
private function cloneArray(array &$array): void
    {
        foreach ($array as $key => $value) {
            if (is_object($value)) {
                $array[$key] = clone $value;
            }
            if (is_array($value)) {
                $this->cloneArray($array[$key]);
            }
        }
    }
920003
private function populateItems(array $array, array $definition)
    {
        $output = $array;
        foreach ($definition as $key => $node) {
            if (isset($node['required'])) {
                if ((!$node['required']) && (!isset($output[$key]))) {
                    $output[$key] = $node['default'];
                }
            } else {
                if (!isset($output[$key])) {
                    $output[$key] = [];
                }
                $output[$key] = $this->populateItems($output[$key], $node);
            }
        }
        return $output;
    }
69756
private function hydrateDefinitionScopeProperty(Definition $definition, array &$definitionArray)
    {
        if (ContainerInterface::SCOPE_CONTAINER !== $definition->getScope()) {
            $definitionArray['scope'] = $definition->getScope();
        }
    }
980111
private function defineCollection($name, $definition)
    {
        // prepare definition object
        if (false === ($definition instanceof Definition)) {
            if (is_string($definition)) {
                $definition = new Definition(array('class' => $definition));
            } elseif (is_array($definition)) {
                $definition = new Definition($definition);
            } else {
                throw new Exception(sprintf('Wrong definition passed for collection %s', $name));
            }
        }

        // set definition
        if ('/' !== substr($name, 0, 1)) {
            $this->mapping[$name] = $definition;
        } else {
            $this->regexpMapping[$name] = $definition;
        }

        return $this;
    }
1283996
public function setData( array $array ) {
        foreach( $array as $name=>$value ) {
            if( !isset( $this->nameHash[$name] ) ) {
                continue;
            }

            $element = $this->nameHash[$name];

            $element->setAttribute( 'value', (string)$value );
        }
    }
1373301
public function set_tags($tags) {
        $this->tags = [];
        foreach ($tags as $tag) {
            // We use $tag->id as the key for the array so not only it handles duplicates of the same tag being given,
            // but also it is consistent with the behaviour of set_tags_by_id() below.
            $this->tags[$tag->id] = $tag;
        }
    }