@param HasExtensionsInterface $objectDefinition

@return ExtensionInterface[]
3019
private function resolveObjectExtensions(HasExtensionsInterface $objectDefinition): array
    {
        $extensions = [];

        //get all extensions registered as services
        $registeredExtensions = $this->container->get(ExtensionManager::class)->getExtensions();
        foreach ($registeredExtensions as $registeredExtension) {
            foreach ($objectDefinition->getExtensions() as $extensionDefinition) {
                $extensionClass = $extensionDefinition->getClass();
                if (\get_class($registeredExtension) === $extensionClass) {
                    $extensions[$extensionClass] = $registeredExtension;
                }
            }
        }

        //get all extensions not registered as services
        foreach ($objectDefinition->getExtensions() as $extensionDefinition) {
            $class = $extensionDefinition->getClass();
            if (!isset($extensions[$class])) {
                $instance = new $class();
                if ($instance instanceof ContainerAwareInterface) {
                    $instance->setContainer($this->container);
                }

                $extensions[$class] = $instance;
            }
        }

        return array_values($extensions);
    }
895127
protected function getExtensionsForAdmin($id, Definition $admin, ContainerBuilder $container, array $extensionMap)
    {
        $extensions = [];
        $classReflection = $subjectReflection = null;

        $excludes = $extensionMap['excludes'];
        unset($extensionMap['excludes']);

        foreach ($extensionMap as $type => $subjects) {
            foreach ($subjects as $subject => $extensionList) {
                if ('admins' === $type) {
                    if ($id === $subject) {
                        $extensions = array_merge($extensions, $extensionList);
                    }
                } else {
                    $class = $this->getManagedClass($admin, $container);
                    if (!class_exists($class)) {
                        continue;
                    }
                    $classReflection = new \ReflectionClass($class);
                    $subjectReflection = new \ReflectionClass($subject);
                }

                if ('instanceof' === $type) {
                    if ($subjectReflection->getName() === $classReflection->getName() || $classReflection->isSubclassOf($subject)) {
                        $extensions = array_merge($extensions, $extensionList);
                    }
                }

                if ('implements' === $type) {
                    if ($classReflection->implementsInterface($subject)) {
                        $extensions = array_merge($extensions, $extensionList);
                    }
                }

                if ('extends' === $type) {
                    if ($classReflection->isSubclassOf($subject)) {
                        $extensions = array_merge($extensions, $extensionList);
                    }
                }

                if ('uses' === $type) {
                    if ($this->hasTrait($classReflection, $subject)) {
                        $extensions = array_merge($extensions, $extensionList);
                    }
                }
            }
        }

        if (isset($excludes[$id])) {
            $extensions = array_diff_key($extensions, $excludes[$id]);
        }

        return $extensions;
    }
1006251
public List<ObjectTypeDefinition> getImplementationsOf(InterfaceTypeDefinition targetInterface) {
        List<ObjectTypeDefinition> objectTypeDefinitions = getTypes(ObjectTypeDefinition.class);
        return objectTypeDefinitions.stream().filter(objectTypeDefinition -> {
            List<Type> implementsList = objectTypeDefinition.getImplements();
            for (Type iFace : implementsList) {
                Optional<InterfaceTypeDefinition> interfaceTypeDef = getType(iFace, InterfaceTypeDefinition.class);
                if (interfaceTypeDef.isPresent()) {
                    boolean equals = interfaceTypeDef.get().getName().equals(targetInterface.getName());
                    if (equals) {
                        return true;
                    }
                }
            }
            return false;
        }).collect(Collectors.toList());
    }
472938
protected function resolveParameters($object, LinkDefinition $definition, array $scope): array
    {
        $resolved = [];

        foreach ($definition->getParameters() as $name => $value)
        {
            if (! preg_match('~@(?:(?<namespace>[a-z0-9_\.]+)\:)?(?<name>[a-z0-9_\.]+)~i', $value, $matches)) {
                $resolved[$name] = $value;
                continue;
            }

            if (empty($matches['namespace'])) {
                $resolved[$name] = $this->accessor->getValue($object, $matches['name']);
                continue;
            }

            if (! isset($scope[$matches['namespace']])) {
                throw new \LogicException(sprintf('Object "%s" not found in the scope.', $matches['namespace']));
            }

            $resolved[$name] = $this->accessor->getValue(
                $scope[$matches['namespace']],
                $matches['name']
            );
        }

        return $resolved;
    }
63541
public static function &GetDefinitions()
    {
        if(!self::ValidExtension())
        {
            CommandLine\Error::Show(t("Invalid extension directory, definitions could not be loaded."));
        }

        if(!is_object(self::$symbols))
        {
            self::$symbols = new Definitions\Symbols;
            
            $importer = new Definitions\Importer(
                self::$symbols, 
                "definitions",
                Definitions\Type::JSON
            );
            
            $importer->Start();
        }

        return self::$symbols;
    }
870894
protected function extractParameters(\stdClass $definition)
    {
        $parameters = [];

        if (isset($definition->parameters)) {
            foreach ($definition->parameters as $parameterDefinition) {
                $parameters[] = $this->createParameter($parameterDefinition);
            }
        }

        return $parameters;
    }
428265
private function resolveArguments(array $argumentDefinitions)
    {
        $arguments = [];

        foreach ($argumentDefinitions as $argumentDefinition) {
            if ($argumentDefinition instanceof ServiceReference) {
                $argumentServiceName = $argumentDefinition->getName();

                $arguments[] = $this->get($argumentServiceName);
            } elseif ($argumentDefinition instanceof ParameterReference) {
                $argumentParameterName = $argumentDefinition->getName();

                $arguments[] = $this->getParameter($argumentParameterName);
            } else {
                $arguments[] = $argumentDefinition;
            }
        }

        return $arguments;
    }
1068894
public function compile($definition)
    {
        $validators = [];

        if (isset($definition->validators)) {
            if (isset($definition->validators['properties'])) {
                foreach ($definition->validators['properties'] as $property => $validatorDefinitions) {
                    foreach ($validatorDefinitions as $validator) {
                        $validators[$property][] = parent::compile($validator);
                    }
                }
            }
        }

        return new ObjectValidator($validators);
    }
988171
public static function objectsMethodValues(array $objectArray, string $methodName): array
    {
        $methodValues = [];

        foreach ($objectArray as $object) {
            $methodValues[] = $object->$methodName();
        }

        return $methodValues;
    }
558260
private function extractProperties(\ReflectionClass $objectClass): array
    {
        return propertiesOf($objectClass, \ReflectionProperty::IS_PUBLIC)
                ->filter(function(\ReflectionProperty $property)
                        {
                            return !$property->isStatic()
                                && !annotationsOf($property)->contain('XmlIgnore');
                        }
                )->map(function(\ReflectionProperty $property)
                        {
                            return $this->createSerializerDelegate(
                                    annotationsOf($property),
                                    $property->getName()
                            );
                        }
                )->data();
    }
429932
private function initializeObjectData(ObjectDataInterface $objectData)
    {
        // handle properties
        if ($objectData->getProperties() !== null) {
            $this->initializeObjectDataProperties($objectData->getProperties());
        }

        // handle allowable actions
        if ($objectData->getAllowableActions() !== null) {
            $this->allowableActions = $objectData->getAllowableActions();
            $this->extensions[(string) ExtensionLevel::cast(
                ExtensionLevel::ALLOWABLE_ACTIONS
            )] = $objectData->getAllowableActions()->getExtensions();
        }

        // handle renditions
        foreach ($objectData->getRenditions() as $rendition) {
            $this->renditions[] = $this->getObjectFactory()->convertRendition($this->getId(), $rendition);
        }

        // handle ACL
        if ($objectData->getAcl() !== null) {
            $this->acl = $objectData->getAcl();
            $this->extensions[(string) ExtensionLevel::cast(ExtensionLevel::ACL)] = $objectData->getAcl(
            )->getExtensions();
        }

        // handle policies
        if ($objectData->getPolicyIds() !== null) {
            $this->initializeObjectDataPolicies($objectData->getPolicyIds());
        }

        // handle relationships
        foreach ($objectData->getRelationships() as $relationshipData) {
            $relationship = $this->getObjectFactory()->convertObject(
                $relationshipData,
                $this->getCreationContext()
            );
            if ($relationship instanceof RelationshipInterface) {
                $this->relationships[] = $relationship;
            }
        }

        $this->extensions[(string) ExtensionLevel::OBJECT] = $objectData->getExtensions();
    }
1221729
public function resolve(DefinitionInterface $definition)
    {
        switch (true) {
            case $definition instanceof ReferenceDefinitionInterface:
                return $this->container->get($definition->getTarget());

            case $definition instanceof ParameterDefinitionInterface:
                return $definition->getValue();

            case $definition instanceof ObjectDefinitionInterface:
                $reflection = new \ReflectionClass($definition->getClassName());

                // Create the instance
                $constructorArguments = $definition->getConstructorArguments();
                $constructorArguments = array_map([$this, 'resolveSubDefinition'], $constructorArguments);
                $service = $reflection->newInstanceArgs($constructorArguments);

                // Set properties
                foreach ($definition->getPropertyAssignments() as $propertyAssignment) {
                    $propertyName = $propertyAssignment->getPropertyName();
                    $service->$propertyName = $this->resolveSubDefinition($propertyAssignment->getValue());
                }

                // Call methods
                foreach ($definition->getMethodCalls() as $methodCall) {
                    $methodArguments = $methodCall->getArguments();
                    $methodArguments = array_map([$this, 'resolveSubDefinition'], $methodArguments);
                    call_user_func_array([$service, $methodCall->getMethodName()], $methodArguments);
                }

                return $service;

            case $definition instanceof FactoryCallDefinitionInterface:
                $factory = $definition->getFactory();
                $methodName = $definition->getMethodName();
                $arguments = (array) $definition->getArguments();
                $arguments = array_map([$this, 'resolveSubDefinition'], $arguments);

                if (is_string($factory)) {
                    return call_user_func_array([$factory, $methodName], $arguments);
                } elseif ($factory instanceof ReferenceDefinitionInterface) {
                    $factory = $this->container->get($factory->getTarget());
                    return call_user_func_array([$factory, $methodName], $arguments);
                }
                throw new InvalidDefinition(sprintf('Definition "%s" does not return a valid factory'));

            default:
                throw UnsupportedDefinition::fromDefinition($definition);
        }
    }
690792
private function convertToFieldDefintionObject($identifier, $fieldDefinition)
    {
        if ($fieldDefinition instanceof FieldDefinitionObject) {
            return $fieldDefinition;
        } else {
            return new FieldDefinitionObject($identifier, $this, $fieldDefinition);
        }
    }
317437
public function mapEntities(array $entityDefinitions)
	{
		foreach($entityDefinitions as $entityIdentifier => $entityDefinition)
		{
			$this->validateAndCompleteEntity($entityIdentifier, $entityDefinition);
		}
	}
20938
public function getContainerExtension(): ?ExtensionInterface
    {
        if (null === $this->extension) {
            $extension = $this->createContainerExtension();

            if (null !== $extension) {
                if (!$extension instanceof ExtensionInterface) {
                    throw new \LogicException(sprintf('Extension %s must implement Symfony\Component\DependencyInjection\Extension\ExtensionInterface.',
                        \get_class($extension)));
                }

                // check naming convention
                $basename      = str_replace(['Component', 'Module', 'Plugin'], ['', '', ''], $this->getIdentifier());
                $expectedAlias = Container::underscore($basename);

                if ($expectedAlias != $extension->getAlias()) {
                    throw new \LogicException(sprintf('Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.',
                        $expectedAlias, $extension->getAlias()));
                }

                $this->extension = $extension;
            }
        }

        return $this->extension;
    }
415704
private function getExtensionList($type, PaginationInterface $pagination)
    {
        $extList = [];
        if (isset($this->typeExtension[$type])) {
            ksort($this->typeExtension[$type]);
            $typeExt = call_user_func_array('array_merge', $this->typeExtension[$type]);
            foreach ($typeExt as $name => $item) {
                $extList = $this->getExtList($name, $pagination, $extList);
            }
        }

        return $extList;
    }
969040
public function getByFileExtension($fileExtension)
    {
        $fileExtension = ltrim($fileExtension);
        $result = [];
        foreach ($this->converters as $converter) {
            if (strcasecmp($fileExtension, $converter->getFileExtension()) === 0) {
                $result[] = $converter;
            }
        }

        return $result;
    }