Jelix 1.6.40

jIniMultiFilesModifier
in package

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

Tags
subpackage

utils

since
1.1

Table of Contents

$master  : jIniFileModifier
$overrider  : jIniFileModifier
__construct()  : mixed
load the two ini files
getMaster()  : jIniFileModifier
getOverrider()  : jIniFileModifier
getValue()  : mixed
return the value of an option from the ini files. If the option doesn't exist, it returns null.
getValues()  : array<string|int, mixed>
return all values of a section from the both ini files.
isModified()  : bool
says if the ini content has been modified
isSection()  : mixed
says if there is a section with the given name.
removeValue()  : mixed
save()  : mixed
save the ini files
setValue()  : mixed
modify an option in the ini file. If the option doesn't exist, it is created.
setValues()  : mixed

Properties

Methods

getValue()

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

public getValue(string $name, string $section[, string $key = null ][, bool $masterOnly = false ]) : mixed
Parameters
$name : string

the name of the option to retrieve

$section : string

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

$key : string = null

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

$masterOnly : bool = false

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)

Return values
mixed

the value

getValues()

return all values of a section from the both ini files.

public getValues(string $section) : array<string|int, mixed>
Parameters
$section : string

the section from wich we want values. 0 is the global section

Return values
array<string|int, mixed>

the list of values, $key=>$value

isModified()

says if the ini content has been modified

public isModified() : bool
Tags
since
1.2
Return values
bool

isSection()

says if there is a section with the given name.

public isSection(mixed $name) : mixed
Parameters
$name : mixed
Return values
mixed

removeValue()

public removeValue(mixed $name, mixed $section[, mixed $key = null ][, mixed $removePreviousComment = true ][, mixed $masterOnly = false ]) : mixed
Parameters
$name : mixed
$section : mixed
$key : mixed = null
$removePreviousComment : mixed = true
$masterOnly : mixed = false
Return values
mixed

save()

save the ini files

public save([mixed $chmod = null ]) : mixed
Parameters
$chmod : mixed = null
Return values
mixed

setValue()

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

public setValue(string $name, string $value, string $section[, string $key = null ][, bool $master = false ]) : mixed
Parameters
$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 = null

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

$master : bool = false

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

Return values
mixed

setValues()

public setValues(mixed $values, mixed $section[, mixed $onMaster = false ]) : mixed
Parameters
$values : mixed
$section : mixed
$onMaster : mixed = false
Return values
mixed

Search results