jIniMultiFilesModifier

utility class to read and modify two ini files at the same time : one master file, and one file which overrides values of the master file, like we have in jelix with mainconfig.ini.php and config.ini.php of an entry point

package

jelix

subpackage

utils

since 1.1

Methods

load the two ini files

__construct(\jIniFileModifier|string $master, \jIniFileModifier|string $overrider) 

Arguments

$master

\jIniFileModifier|string

the master ini file (object or filename)

$overrider

\jIniFileModifier|string

the ini file overriding the master ini file (object or filename)

getMaster

getMaster() : \jIniFileModifier
since 1.2

Response

\jIniFileModifier

the first ini file

getOverrider

getOverrider() : \jIniFileModifier
since 1.2

Response

\jIniFileModifier

the second ini file

return the value of an option from the ini files. If the option doesn't exist, it returns null.

getValue(string $name, string $section, string $key = null, boolean $masterOnly = false) : mixed

Arguments

$name

string

the name of the option to retrieve

$section

string

the section where the option is. 0 is the global section

$key

string

for option which is an item of array, the key in the array

$masterOnly

boolean

if true, get the value from the master file, else get the value from the overrider file or from the master file if the value doesn't exists in the overrider file (default)

Response

mixed

the value

says if the ini content has been modified

isModified() : boolean
since 1.2

Response

boolean

removeValue

removeValue( $name,  $section,  $key = null,  $removePreviousComment = true,  $masterOnly = false) 

Arguments

$name

$section

$key

$removePreviousComment

$masterOnly

save the ini files

save( $chmod = null) 

Arguments

$chmod

modify an option in the ini file. If the option doesn't exist, it is created.

setValue(string $name, string $value, string $section, string $key = null, boolean $master = false) 

Arguments

$name

string

the name of the option to modify

$value

string

the new value

$section

string

the section where to set the item. 0 is the global section

$key

string

for option which is an item of array, the key in the array

$master

boolean

if true, change the value in the master file, else change the value in the overrider file (default)

setValues

setValues( $values,  $section,  $onMaster = false) 

Arguments

$values

$section

$onMaster

Properties

master

master : \jIniFileModifier
var

Type(s)

\jIniFileModifier

overrider

overrider : \jIniFileModifier
var

Type(s)

\jIniFileModifier