public static function dumpToFile(Config $config, $type)
    {
        if ($type === Config::CONFIG_LOCAL) {
            $filename = $config->get('local_config');

            if (null === $filename) {
                throw new \RuntimeException('Local configuration is not loaded and therefore it cannot be dumped.');
            }
        } elseif ($type === Config::CONFIG_SYSTEM) {
            $filename = $config->get('home_config');
        } else {
            throw new \InvalidArgumentException(
                sprintf(
                    'Config slot "%s" is not valid for dumping to a file "%s", use either: '.
                    'Config::CONFIG_SYSTEM or Config::CONFIG_LOCAL.',
                    $type
                )
            );
        }

        // Testing compatibility, write directly as there is no risk of problems
        if ('vfs://' === substr($filename, 0, 6)) {
            file_put_contents($filename, Yaml::dump($config->toArray($type)));
        } else {
            self::getFilesystem()->dumpFile(
                $filename,
                "# Gush configuration file, any comments will be lost.\n".Yaml::dump($config->toArray($type), 2)
            );
        }

        return $filename;
    }
public static function dumpToFile(Config $config, $type)
    {
        if ($type === Config::CONFIG_LOCAL) {
            $filename = $config->get('local_config');

            if (null === $filename) {
                throw new \RuntimeException('Local configuration is not loaded and therefore it cannot be dumped.');
            }
        } elseif ($type === Config::CONFIG_SYSTEM) {
            $filename = $config->get('home_config');
        } else {
            throw new \InvalidArgumentException(
                sprintf(
                    'Config slot "%s" is not valid for dumping to a file "%s", use either: '.
                    'Config::CONFIG_SYSTEM or Config::CONFIG_LOCAL.',
                    $type
                )
            );
        }

        // Testing compatibility, write directly as there is no risk of problems
        if ('vfs://' === substr($filename, 0, 6)) {
            file_put_contents($filename, Yaml::dump($config->toArray($type)));
        } else {
            self::getFilesystem()->dumpFile(
                $filename,
                "# Gush configuration file, any comments will be lost.\n".Yaml::dump($config->toArray($type), 2)
            );
        }

        return $filename;
    }
public static function dumpToFile ( Config $ config , $ type ) { if ( $ type === Config :: CONFIG_LOCAL ) { $ filename = $ config -> get ( 'local_config' ) ; if ( null === $ filename ) { throw new \ RuntimeException ( 'Local configuration is not loaded and therefore it cannot be dumped.' ) ; } } elseif ( $ type === Config :: CONFIG_SYSTEM ) { $ filename = $ config -> get ( 'home_config' ) ; } else { throw new \ InvalidArgumentException ( sprintf ( 'Config slot "%s" is not valid for dumping to a file "%s", use either: ' . 'Config::CONFIG_SYSTEM or Config::CONFIG_LOCAL.' , $ type ) ) ; } // Testing compatibility, write directly as there is no risk of problems if ( 'vfs://' === substr ( $ filename , 0 , 6 ) ) { file_put_contents ( $ filename , Yaml :: dump ( $ config -> toArray ( $ type ) ) ) ; } else { self :: getFilesystem ( ) -> dumpFile ( $ filename , "# Gush configuration file, any comments will be lost.\n" . Yaml :: dump ( $ config -> toArray ( $ type ) , 2 ) ) ; } return $ filename ; }
Dump configuration to the related config-file.

The config-file is automatically determined using
type.

@param Config $config
@param string $type

@return string
Dump configuration to the related config - file .