Detailed Description
InifileConfiguration reads the application configuration from ini files.
- Note
- This class only supports ini files with sections.
Definition at line 30 of file InifileConfiguration.php.
Public Member Functions | |
__construct ($configPath, $cachePath=null) | |
__toString () | |
getConfigPath () | |
getConfigurations () | |
addConfiguration ($name, $processValues=true) | |
getSections () | |
hasSection ($section) | |
getSection ($section, $includeMeta=false) | |
hasValue ($key, $section) | |
getValue ($key, $section) | |
getBooleanValue ($key, $section) | |
getDirectoryValue ($key, $section) | |
getFileValue ($key, $section) | |
getKey ($value, $section) | |
isEditable ($section) | |
isModified () | |
createSection ($section) | |
removeSection ($section) | |
renameSection ($oldname, $newname) | |
setValue ($key, $value, $section, $createSection=true) | |
removeKey ($key, $section) | |
renameKey ($oldname, $newname, $section) | |
writeConfiguration ($name) | |
Protected Member Functions | |
processFile ($filename, $configArray=[], $parsedFiles=[]) | |
parseIniFile ($filename) | |
processValues () | |
processValue (&$value) | |
configMerge ($array1, $array2, $override) | |
getConfigIncludes ($array) | |
serialize () | |
unserialize ($parsedFiles) | |
getSerializeFilename ($parsedFiles) | |
checkFileDate ($fileList, $referenceFile) | |
configChanged () | |
buildLookupTable () | |
lookup ($section, $key=null) | |
Constructor & Destructor Documentation
◆ __construct()
__construct | ( | $configPath, | |
$cachePath = null |
|||
) |
Constructor.
- Parameters
-
$configPath The path, either absolute or relative to the executed script $cachePath The cache path, either absolute or relative to the executed script (optional)
Definition at line 56 of file InifileConfiguration.php.
Member Function Documentation
◆ __toString()
__toString | ( | ) |
Definition at line 65 of file InifileConfiguration.php.
◆ getConfigPath()
getConfigPath | ( | ) |
Get the file system path to the configuration files.
- Returns
- The path, either absolute or relative to the executed script
Definition at line 83 of file InifileConfiguration.php.
◆ getConfigurations()
getConfigurations | ( | ) |
Configuration interface.
Implements Configuration.
Definition at line 94 of file InifileConfiguration.php.
◆ addConfiguration()
addConfiguration | ( | $name, | |
$processValues = true |
|||
) |
- See also
- Configuration::addConfiguration() Name is the ini file to be parsed (relative to configPath)
- Note
- ini files referenced in section 'config' key 'include' are parsed afterwards
Implements Configuration.
Definition at line 103 of file InifileConfiguration.php.
◆ processFile()
|
protected |
Process the given file recursively.
- Parameters
-
$filename The filename $configArray Configuration array $parsedFiles Parsed files
- Returns
- Associative array with keys 'config' (configuration array) and 'files' (array of parsed files)
Definition at line 174 of file InifileConfiguration.php.
◆ getSections()
getSections | ( | ) |
- See also
- Configuration::getSections()
Implements Configuration.
Definition at line 201 of file InifileConfiguration.php.
◆ hasSection()
hasSection | ( | $section | ) |
- See also
- Configuration::hasSection()
Implements Configuration.
Definition at line 208 of file InifileConfiguration.php.
◆ getSection()
getSection | ( | $section, | |
$includeMeta = false |
|||
) |
- See also
- Configuration::getSection()
Implements Configuration.
Definition at line 215 of file InifileConfiguration.php.
◆ hasValue()
hasValue | ( | $key, | |
$section | |||
) |
- See also
- Configuration::hasValue()
Implements Configuration.
Definition at line 235 of file InifileConfiguration.php.
◆ getValue()
getValue | ( | $key, | |
$section | |||
) |
- See also
- Configuration::getValue()
Implements Configuration.
Definition at line 242 of file InifileConfiguration.php.
◆ getBooleanValue()
getBooleanValue | ( | $key, | |
$section | |||
) |
- See also
- Configuration::getBooleanValue()
Implements Configuration.
Definition at line 255 of file InifileConfiguration.php.
◆ getDirectoryValue()
getDirectoryValue | ( | $key, | |
$section | |||
) |
Implements Configuration.
Definition at line 263 of file InifileConfiguration.php.
◆ getFileValue()
getFileValue | ( | $key, | |
$section | |||
) |
- See also
- Configuration::getFileValue()
Implements Configuration.
Definition at line 280 of file InifileConfiguration.php.
◆ getKey()
getKey | ( | $value, | |
$section | |||
) |
- See also
- Configuration::getKey()
Implements Configuration.
Definition at line 297 of file InifileConfiguration.php.
◆ isEditable()
isEditable | ( | $section | ) |
WritableConfiguration interface.
Implements WritableConfiguration.
Definition at line 312 of file InifileConfiguration.php.
◆ isModified()
isModified | ( | ) |
Implements WritableConfiguration.
Definition at line 330 of file InifileConfiguration.php.
◆ createSection()
createSection | ( | $section | ) |
Implements WritableConfiguration.
Definition at line 337 of file InifileConfiguration.php.
◆ removeSection()
removeSection | ( | $section | ) |
Implements WritableConfiguration.
Definition at line 354 of file InifileConfiguration.php.
◆ renameSection()
renameSection | ( | $oldname, | |
$newname | |||
) |
Implements WritableConfiguration.
Definition at line 369 of file InifileConfiguration.php.
◆ setValue()
setValue | ( | $key, | |
$value, | |||
$section, | |||
$createSection = true |
|||
) |
Implements WritableConfiguration.
Definition at line 396 of file InifileConfiguration.php.
◆ removeKey()
removeKey | ( | $key, | |
$section | |||
) |
Implements WritableConfiguration.
Definition at line 440 of file InifileConfiguration.php.
◆ renameKey()
renameKey | ( | $oldname, | |
$newname, | |||
$section | |||
) |
Implements WritableConfiguration.
Definition at line 455 of file InifileConfiguration.php.
◆ writeConfiguration()
writeConfiguration | ( | $name | ) |
Implements WritableConfiguration.
Definition at line 485 of file InifileConfiguration.php.
◆ parseIniFile()
|
protected |
Private interface.
Load in the ini file specified in filename, and return the settings in a multidimensional array, with the section names and settings included. All section names and keys are lowercased.
- Parameters
-
$filename The filename of the ini file to parse
- Returns
- An associative array containing the data
Definition at line 535 of file InifileConfiguration.php.
◆ processValues()
|
protected |
Process the values in the ini array.
This method turns string values that hold array definitions (comma separated values enclosed by curly brackets) into array values.
Definition at line 581 of file InifileConfiguration.php.
◆ processValue()
|
protected |
Process the values in the ini array.
This method turns string values that hold array definitions (comma separated values enclosed by curly brackets) into array values.
- Parameters
-
$value A reference to the value
Definition at line 591 of file InifileConfiguration.php.
◆ configMerge()
|
protected |
Merge the second array into the first, preserving entries of the first array unless the second array contains the special key '__inherit' set to false or they are re-defined in the second array.
- Parameters
-
$array1 First array. $array2 Second array. $override Boolean whether values defined in array1 should be overridden by values defined in array2.
- Returns
- The merged array.
Definition at line 617 of file InifileConfiguration.php.
◆ getConfigIncludes()
|
protected |
Search the given value for a 'include' key in a section named 'config' (case-insensivite)
- Parameters
-
$array The array to search in
- Returns
- Mixed
Definition at line 649 of file InifileConfiguration.php.
◆ serialize()
|
protected |
Store the instance in the file system.
If the instance is modified, this call is ignored.
Definition at line 666 of file InifileConfiguration.php.
◆ unserialize()
|
protected |
Retrieve parsed ini data from the file system and update the current instance.
If the current instance is modified or any file given in parsedFiles is newer than the serialized data, this call is ignored. If InifileConfiguration class changed, the call will be ignored as well.
- Parameters
-
$parsedFiles An array of ini filenames that must be contained in the data.
- Returns
- Boolean whether the data could be retrieved or not
Definition at line 690 of file InifileConfiguration.php.
◆ getSerializeFilename()
|
protected |
Get the filename for the serialized data that correspond to the the given ini file sequence.
NOTE: The method returns null, if no cache path is configured
- Parameters
-
$parsedFiles An array of parsed filenames
- Returns
- String
Definition at line 720 of file InifileConfiguration.php.
◆ checkFileDate()
|
protected |
Check if one file in fileList is newer than the referenceFile.
- Parameters
-
$fileList An array of files $referenceFile The file to check against
- Returns
- True, if one of the files is newer, false else
Definition at line 735 of file InifileConfiguration.php.
◆ configChanged()
|
protected |
Notify configuration change listeners.
Definition at line 747 of file InifileConfiguration.php.
◆ buildLookupTable()
|
protected |
Build the internal lookup table.
Definition at line 763 of file InifileConfiguration.php.
◆ lookup()
|
protected |
Lookup section and key.
- Parameters
-
$section The section to lookup $key The key to lookup (optional)
- Returns
- Array with section as first entry and key as second or null if not found
Definition at line 783 of file InifileConfiguration.php.