PHP Class Bolt\Configuration\YamlUpdater

Author: Bob den Otter ([email protected])
Mostrar archivo Open project: bolt/bolt Class Usage Examples

Public Methods

Method Description
__construct ( Silex\Application $app, string $filename = '' ) Creates an updater for the given file.
change ( string $key, string $value, boolean $makeBackup = true ) : boolean Updates a single value with replacement for given key in yml file.
get ( string $key ) : boolean | array Return a value for a key from the yml file.
prepareValue ( string $value ) : string Make sure the value is escaped as a yaml value.

Protected Methods

Method Description
backup ( ) Backup the YAML file.
save ( boolean $makebackup ) : boolean Save our modified .yml file.
verify ( ) : boolean Verify if the modified YAML is still a valid .yml file, and if we are actually allowed to write and update the current file.

Method Details

__construct() public method

Creates an updater for the given file.
public __construct ( Silex\Application $app, string $filename = '' )
$app Silex\Application
$filename string The file to modify

backup() protected method

Backup the YAML file.
protected backup ( )

change() public method

Updates a single value with replacement for given key in yml file.
public change ( string $key, string $value, boolean $makeBackup = true ) : boolean
$key string
$value string
$makeBackup boolean
return boolean

get() public method

Return a value for a key from the yml file.
public get ( string $key ) : boolean | array
$key string
return boolean | array

prepareValue() public method

array('one', 'two', 'three') => [ one, two, three ] "usin' quotes" => 'usin'' quotes
public prepareValue ( string $value ) : string
$value string
return string

save() protected method

Save our modified .yml file.
protected save ( boolean $makebackup ) : boolean
$makebackup boolean Back up the file before commiting changes to it
return boolean true if save was successful

verify() protected method

Verify if the modified YAML is still a valid .yml file, and if we are actually allowed to write and update the current file.
protected verify ( ) : boolean
return boolean