Register class definitions.

Class definitions have the form $className => (array) $formatDefinitions

@param array $classDefinitions
346633
public function registerClasses(array $classDefinitions)
    {
        foreach ($classDefinitions as $className => $formatDefinitions) {
            $this->registerClass($className, $formatDefinitions);
        }
    }
290440
public function registerFormWidget($className, $widgetInfo = null)
    {
        if (!is_array($widgetInfo)) {
            $widgetInfo = ['code' => $widgetInfo];
        }

        $widgetCode = $widgetInfo['code'] ?? null;

        if (!$widgetCode) {
            $widgetCode = Str::getClassId($className);
        }

        $this->formWidgets[$className] = $widgetInfo;
        $this->formWidgetHints[$widgetCode] = $className;
    }
460161
protected function defineEntity(ClassDefinition $class)
    {
        $class->property($this->question)->asString();

        $class->property($this->answer)->asObject(Html::class);

        $class->property($this->orderToDisplay)->asInt();

        $class->property($this->updatedAt)->asObject(DateTime::class);
        
        $class->property($this->createdAt)->asObject(DateTime::class);
    }
269806
public function setParentClassNames(array $classNames)
    {
        $this->parentClassNames = $classNames;

        if (count($classNames) > 0) {
            $this->rootDocumentName = array_pop($classNames);
        }
    }
417955
public function setClassNames(array $classNames): void
    {
        $this->classNames = count($classNames) > 0 ? array_combine($classNames, array_fill(0, count($classNames), true)) : [];
    }
578795
private function registerClass(ContainerBuilder $container, $className, array $tags, array $methods)
    {
        if ($container->has($className)) {
            return;
        }

        $definition = $container->register($className, $className);
        if (method_exists($definition, 'setAutowiredMethods')) {
            $definition->setAutowiredMethods($methods);
        } else {
            $definition->setAutowired(true);
        }

        // Inject the container if applicable
        if (is_a($className, ContainerAwareInterface::class, true)) {
            $definition->addMethodCall('setContainer', [new Reference('service_container')]);
        }

        foreach ($tags as $tagClassName => $classTags) {
            if (!is_a($className, $tagClassName, true)) {
                continue;
            }

            foreach ($classTags as $classTag) {
                $definition->addTag($classTag[0], $classTag[1]);
            }
        }
    }
922642
private function isClassCacheable($classDefinition)
    {
        if ($classDefinition instanceof ClassDefinition) {
            return true;
        }
        if ($classDefinition instanceof \ReflectionClass) {
            if ($classDefinition->isInternal() && $classDefinition->isInstantiable()) {
                $extension = $classDefinition->getExtension();
                switch ($extension->getName()) {
                    case 'Reflection':
                    case 'Core':
                    case 'SPL':
                        return true;
                }
            }
        }

        return false;
    }
960034
protected function buildAnnotationsInstances(array $annotationDefinitions)
    {
        $result = array();
        foreach ($annotationDefinitions as $annotationDefinition) {
            $result[] = $this->buildAnnotationInstance($annotationDefinition);
        }

        return $result;
    }
146107
private function getOrCreateClassMetadataDefinition(string $className, ?ClassMetadata $parent) : ClassMetadataDefinition
    {
        if (! isset($this->definitions[$className])) {
            $this->definitions[$className] = $this->definitionFactory->build($className, $parent);
        }

        return $this->definitions[$className];
    }
443596
protected function define(ClassDefinition $class)
    {
        $class->property($this->red)->asInt();

        $class->property($this->green)->asInt();

        $class->property($this->blue)->asInt();
    }
5938
public function addDataTypeDefinition($typeName, $typeClass, $classpath = null)
    {
        ComponentHelper::getComponentHelper($this)->addDataTypeDefinition($typeName, $typeClass, $classpath);
    }
1216973
public function setParentClasses(array $classNames) : void
    {
        $this->parentClasses = $classNames;

        if (count($classNames) <= 0) {
            return;
        }

        $this->rootDocumentName = (string) array_pop($classNames);
    }
1175807
protected function define(ClassDefinition $class)
    {
        $class->property($this->lat)->asFloat();
        $class->property($this->lng)->asFloat();
    }
173372
public function registerFormat($format, $class)
    {
        if(!class_exists($class, true)) {
            throw new \InvalidArgumentException('Class : '.$class.' cannot does not exist.');
        }

        $this->_formats[$format] = $class;

        //In case the format is being re-registered clear the prototype
        if(isset($this->__prototypes[$format])) {
            unset($this->__prototypes[$format]);
        }

        return $this;
    }
936682
protected function defineEntity(ClassDefinition $class)
    {
        $class->property($this->driverName)->asString();

        $class->property($this->options)->asObject(FormObject::class);
    }
118427
private function registerGuzzlePlugin(Definition $clientDefinition, array $plugins)
    {
        foreach ($plugins as $pluginId => $attributes) {
            $clientDefinition->addMethodCall(
                'addSubscriber',
                array(new Reference($pluginId))
            );
        }
    }
575095
public function addFieldDefinitionObject($identifier, $fieldDefinition)
    {
        $this->data['fields'][$identifier] = $this->convertToFieldDefintionObject($identifier, $fieldDefinition);
    }