public function getInstanceFromClassName($className, $name)
    {
        if (false === class_exists($className)) {
            throw ClassNotFoundException::wrongFormClassName($className);
        }

        if (false === in_array(FormInterface::class, class_implements($className))) {
            throw InvalidArgumentTypeException::wrongFormType($className);
        }

        $cacheIdentifier = $this->getCacheIdentifier($className, $name);

        if (false === isset($this->instances[$cacheIdentifier])) {
            $cacheInstance = CacheService::get()->getCacheInstance();

            if ($cacheInstance->has($cacheIdentifier)) {
                $instance = $cacheInstance->get($cacheIdentifier);
            } else {
                $instance = $this->createInstance($className, $name);
                $cacheInstance->set($cacheIdentifier, $instance);
            }

            /** @var Configuration $formzConfigurationObject */
            $formzConfigurationObject = $this->configurationFactory
                ->getFormzConfiguration()
                ->getObject(true);

            if (false === $formzConfigurationObject->hasForm($instance->getClassName(), $instance->getName())) {
                $formzConfigurationObject->addForm($instance);
            }

            $this->instances[$cacheIdentifier] = $instance;
        }

        return $this->instances[$cacheIdentifier];
    }
public function getInstanceFromClassName($className, $name)
    {
        if (false === class_exists($className)) {
            throw ClassNotFoundException::wrongFormClassName($className);
        }

        if (false === in_array(FormInterface::class, class_implements($className))) {
            throw InvalidArgumentTypeException::wrongFormType($className);
        }

        $cacheIdentifier = $this->getCacheIdentifier($className, $name);

        if (false === isset($this->instances[$cacheIdentifier])) {
            $cacheInstance = CacheService::get()->getCacheInstance();

            if ($cacheInstance->has($cacheIdentifier)) {
                $instance = $cacheInstance->get($cacheIdentifier);
            } else {
                $instance = $this->createInstance($className, $name);
                $cacheInstance->set($cacheIdentifier, $instance);
            }

            /** @var Configuration $formzConfigurationObject */
            $formzConfigurationObject = $this->configurationFactory
                ->getFormzConfiguration()
                ->getObject(true);

            if (false === $formzConfigurationObject->hasForm($instance->getClassName(), $instance->getName())) {
                $formzConfigurationObject->addForm($instance);
            }

            $this->instances[$cacheIdentifier] = $instance;
        }

        return $this->instances[$cacheIdentifier];
    }
public function getInstanceFromClassName ( $ className , $ name ) { if ( false === class_exists ( $ className ) ) { throw ClassNotFoundException :: wrongFormClassName ( $ className ) ; } if ( false === in_array ( FormInterface :: class , class_implements ( $ className ) ) ) { throw InvalidArgumentTypeException :: wrongFormType ( $ className ) ; } $ cacheIdentifier = $ this -> getCacheIdentifier ( $ className , $ name ) ; if ( false === isset ( $ this -> instances [ $ cacheIdentifier ] ) ) { $ cacheInstance = CacheService :: get ( ) -> getCacheInstance ( ) ; if ( $ cacheInstance -> has ( $ cacheIdentifier ) ) { $ instance = $ cacheInstance -> get ( $ cacheIdentifier ) ; } else { $ instance = $ this -> createInstance ( $ className , $ name ) ; $ cacheInstance -> set ( $ cacheIdentifier , $ instance ) ; } /** @var Configuration $formzConfigurationObject */ $ formzConfigurationObject = $ this -> configurationFactory -> getFormzConfiguration ( ) -> getObject ( true ) ; if ( false === $ formzConfigurationObject -> hasForm ( $ instance -> getClassName ( ) , $ instance -> getName ( ) ) ) { $ formzConfigurationObject -> addForm ( $ instance ) ; } $ this -> instances [ $ cacheIdentifier ] = $ instance ; } return $ this -> instances [ $ cacheIdentifier ] ; }
Will create an instance of `FormObject` based on a class which implements
the interface `FormInterface`.

@param string $className
@param string $name
@return FormObject
@throws ClassNotFoundException
@throws InvalidArgumentTypeException
Will create an instance of FormObject based on a class which implements the interface FormInterface .