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();
    }