public static function create(string $configType, ClassType $classType, array $options = [])
    {
        $classType = (string)$classType;

        $classMapVersion = empty($options['classMapVersion']) ? Configure::read('ModuleConfig.classMapVersion') : (string)$options['classMapVersion'];
        $classMap = empty($options['classMap'][$classMapVersion]) ? Configure::read('ModuleConfig.classMap.' . $classMapVersion) : (array)$options['classMap'][$classMapVersion];
        if (empty($classMap[$configType][$classType])) {
            throw new InvalidArgumentException("No [$classType] found for configuration type [$configType] in class map version [$classMapVersion]");
        }

        $className = $classMap[$configType][$classType];
        $params = $options['classArgs'] ?? [];
        $result = static::getInstance($className, $params);

        return $result;
    }
public static function create(string $configType, ClassType $classType, array $options = [])
    {
        $classType = (string)$classType;

        $classMapVersion = empty($options['classMapVersion']) ? Configure::read('ModuleConfig.classMapVersion') : (string)$options['classMapVersion'];
        $classMap = empty($options['classMap'][$classMapVersion]) ? Configure::read('ModuleConfig.classMap.' . $classMapVersion) : (array)$options['classMap'][$classMapVersion];
        if (empty($classMap[$configType][$classType])) {
            throw new InvalidArgumentException("No [$classType] found for configuration type [$configType] in class map version [$classMapVersion]");
        }

        $className = $classMap[$configType][$classType];
        $params = $options['classArgs'] ?? [];
        $result = static::getInstance($className, $params);

        return $result;
    }
public static function create ( string $ configType , ClassType $ classType , array $ options = [ ] ) { $ classType = ( string ) $ classType ; $ classMapVersion = empty ( $ options [ 'classMapVersion' ] ) ? Configure :: read ( 'ModuleConfig.classMapVersion' ) : ( string ) $ options [ 'classMapVersion' ] ; $ classMap = empty ( $ options [ 'classMap' ] [ $ classMapVersion ] ) ? Configure :: read ( 'ModuleConfig.classMap.' . $ classMapVersion ) : ( array ) $ options [ 'classMap' ] [ $ classMapVersion ] ; if ( empty ( $ classMap [ $ configType ] [ $ classType ] ) ) { throw new InvalidArgumentException ( "No [$classType] found for configuration type [$configType] in class map version [$classMapVersion]" ) ; } $ className = $ classMap [ $ configType ] [ $ classType ] ; $ params = $ options [ 'classArgs' ] ?? [ ] ; $ result = static :: getInstance ( $ className , $ params ) ; return $ result ; }
Create a new instance of a helper class

Options:
- classArgs: array of class arguments which will be passed to the constructor.

@throws \InvalidArgumentException when cannot create instance
@param string $configType Configuration type
@param \Qobo\Utils\ModuleConfig\ClassType $classType Class type
@param mixed[] $options Options
@return object
Create a new instance of a helper class