protected function getConfigurationFactory(string $path): AbstractConsoleConfigFactory
    {
        if (! file_exists($path)) {
            throw new InvalidConfigException(sprintf('Config file "%s" does not exists', $path));
        }

        $extension = pathinfo($path, PATHINFO_EXTENSION);
        if (! Validator::key($extension)->validate(static::CONSOLE_CONFIG_FACTORIES)) {
            throw new InvalidConfigException(
                sprintf('Config file "%s" must have .yml, .json or .php extension', $path)
            );
        }

        /** @var AbstractConsoleConfigFactory $factory */
        $factoryClass = static::CONSOLE_CONFIG_FACTORIES[$extension];
        return new $factoryClass();
    }
protected function getConfigurationFactory(string $path): AbstractConsoleConfigFactory
    {
        if (! file_exists($path)) {
            throw new InvalidConfigException(sprintf('Config file "%s" does not exists', $path));
        }

        $extension = pathinfo($path, PATHINFO_EXTENSION);
        if (! Validator::key($extension)->validate(static::CONSOLE_CONFIG_FACTORIES)) {
            throw new InvalidConfigException(
                sprintf('Config file "%s" must have .yml, .json or .php extension', $path)
            );
        }

        /** @var AbstractConsoleConfigFactory $factory */
        $factoryClass = static::CONSOLE_CONFIG_FACTORIES[$extension];
        return new $factoryClass();
    }
protected function getConfigurationFactory ( string $ path ) : AbstractConsoleConfigFactory { if ( ! file_exists ( $ path ) ) { throw new InvalidConfigException ( sprintf ( 'Config file "%s" does not exists' , $ path ) ) ; } $ extension = pathinfo ( $ path , PATHINFO_EXTENSION ) ; if ( ! Validator :: key ( $ extension ) -> validate ( static :: CONSOLE_CONFIG_FACTORIES ) ) { throw new InvalidConfigException ( sprintf ( 'Config file "%s" must have .yml, .json or .php extension' , $ path ) ) ; } /** @var AbstractConsoleConfigFactory $factory */ $ factoryClass = static :: CONSOLE_CONFIG_FACTORIES [ $ extension ] ; return new $ factoryClass ( ) ; }
Get the configuration factory depending on configuration path.

@param string $path The configuration file path.

@return AbstractConsoleConfigFactory The configuration factory.

@throws InvalidConfigException If the configuration is invalid.
Get the configuration factory depending on configuration path .