public static function save($data, $path = null, $php_var = 'config') {
        if (!is_array($data)) {
            throw new \InvalidArgumentException('Config::save(): Argument #1 is not an array.', 400);
        }

        if (!$path) {
            $path = static::defaultPath();
        }

        // Load the current config information so we know what to replace.
        $config = array_load($path, $php_var);
        // Merge the new config into the current config.
        $config = array_replace($config, $data);
        // Remove null config values.
        $config = array_filter($config, function ($value) {
            return $value !== null;
        });

        ksort($config, SORT_NATURAL | SORT_FLAG_CASE);

        $result = array_save($config, $path, $php_var);
        return $result;
    }
public static function save($data, $path = null, $php_var = 'config') {
        if (!is_array($data)) {
            throw new \InvalidArgumentException('Config::save(): Argument #1 is not an array.', 400);
        }

        if (!$path) {
            $path = static::defaultPath();
        }

        // Load the current config information so we know what to replace.
        $config = array_load($path, $php_var);
        // Merge the new config into the current config.
        $config = array_replace($config, $data);
        // Remove null config values.
        $config = array_filter($config, function ($value) {
            return $value !== null;
        });

        ksort($config, SORT_NATURAL | SORT_FLAG_CASE);

        $result = array_save($config, $path, $php_var);
        return $result;
    }
public static function save ( $ data , $ path = null , $ php_var = 'config' ) { if ( ! is_array ( $ data ) ) { throw new \ InvalidArgumentException ( 'Config::save(): Argument #1 is not an array.' , 400 ) ; } if ( ! $ path ) { $ path = static :: defaultPath ( ) ; } // Load the current config information so we know what to replace. $ config = array_load ( $ path , $ php_var ) ; // Merge the new config into the current config. $ config = array_replace ( $ config , $ data ) ; // Remove null config values. $ config = array_filter ( $ config , function ( $ value ) { return $ value !== null ; } ) ; ksort ( $ config , SORT_NATURAL | SORT_FLAG_CASE ) ; $ result = array_save ( $ config , $ path , $ php_var ) ; return $ result ; }
Save data to the config file.

@param array $data The config data to save.
@param string $path An optional path to save the data to.
@param string $php_var The name of the php variable to load from if using the php file type.
@return bool Returns true if the save was successful or false otherwise.
@throws \InvalidArgumentException Throws an exception when the saved data isn't an array.
Save data to the config file .