프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$Data | Holds the associative array of configuration data.
ie. $this->_Data['Group0']['Group1']['ConfigurationName'] = 'Value'; |
||
$NotFound | string |
프로퍼티 | 타입 | 설명 | |
---|---|---|---|
$autoSave | Whether or not to autosave this config when it is destructed. | ||
$defaultGroup | The default top level group for new configs. | ||
$defaultPath | The path to the default configuration file. | ||
$dynamic | Dynamic (writable) config source. This is the configuration source that is written to when saves or removes are occurring. | ||
$sources | Configuration Source List Associative array of Gdn_ConfigurationSource objects indexed by their respective types and source URIs. E.g: file:/path/to/config/file.php => ... string:tagname => ... | ||
$splitting | Allow dot-delimited splitting? | ||
$useCaching | Use caching to load and save configs? |
메소드 | 설명 | |
---|---|---|
__construct ( string $DefaultGroup = null ) | Initialize a new instance of the {@link Gdn_Configuration} class. | |
__destruct ( ) | ||
autoSave ( boolean $AutoSave = true ) | ||
caching ( boolean $Caching = null ) : boolean | Use caching when loading/saving configs. | |
clearCache ( string $ConfigFile ) : void | Clear cache entry for this config file. | |
clearSaveData ( ) | ||
defaultPath ( string $Value = null ) : string | Gets or sets the path of the default configuration file. | |
dynamic ( ) : Gdn_ConfigurationSource | Get current dynamic ConfigurationSource | |
find ( string $Name, boolean $Create = true ) : mixed | Finds the data at a given position and returns a reference to it. | |
format ( $Data, array $Options = [] ) : string | ||
get ( string $Name, mixed $DefaultValue = false ) : mixed | Gets a setting from the configuration array. Returns $DefaultValue if the value isn't found. | |
getSortFlag ( ) : null | integer | ||
getSource ( string $Type, string $Identifier ) : ConfigurationSource | Get a reference to the internal ConfigurationSource for a given type and ID | |
load ( string $File, string $Name = 'Configuration', boolean $Dynamic = false ) : boolean | Loads an array of settings from a file into the object with the specified name; | |
loadArray ( string $ConfigData, string $Tag, string $Name = 'Configuration', boolean $Dynamic = true, $SaveCallback = null, $CallbackOptions = null ) : boolean | Loads settings from an array into the object with the specified name; | |
loadFile ( $Path, $Options = [] ) | DO NOT USE, THIS IS RUBBISH | |
loadString ( string $String, string $Tag, string $Name = 'Configuration', boolean $Dynamic = true, $SaveCallback = null, $CallbackOptions = null ) : boolean | Loads settings from a string into the object with the specified name; | |
massImport ( type $Data ) | Import a large pre-formatted set of configs efficiently | |
overlayDynamic ( ) | Re-apply the settings from the current dynamic config source | |
remove ( string $Name, $Save = true ) : boolean | Removes the specified key from the specified group (if it exists). | |
removeFromConfig ( string | array $Name, boolean | array $Options = [] ) | Remove key (or keys) from config | |
save ( string $File = null, string $Group = null ) : boolean | Saves all settings in $Group to $File. | |
saveFile ( $Path, $Data, array $Options = [] ) | ||
saveToConfig ( $Name, string $Value = '', array $Options = [] ) : boolean | integer | ||
set ( string $Name, mixed $Value, boolean $Overwrite = true, $Save = true ) | Assigns a setting to the configuration array. | |
setSortFlag ( integer $sortFlag ) : Gdn_Configuration | Set the sort flag to be used with ksort. | |
shutdown ( ) | ||
splitting ( boolean $Splitting = true ) | Allow dot-delimited splitting on keys? |
메소드 | 설명 | |
---|---|---|
isList ( array &$list ) : boolean | Determine if a given array is a list (or a hash) | |
mergeConfig ( array &$Data, array $Loaded ) | Merge a newly loaded config into the current active state |
public __construct ( string $DefaultGroup = null ) | ||
$DefaultGroup | string |
public clearCache ( string $ConfigFile ) : void | ||
$ConfigFile | string | |
리턴 | void |
public defaultPath ( string $Value = null ) : string | ||
$Value | string | Pass a value to set a new default config path. |
리턴 | string | Returns the current default config path. |
public dynamic ( ) : Gdn_ConfigurationSource | ||
리턴 | Gdn_ConfigurationSource |
public get ( string $Name, mixed $DefaultValue = false ) : mixed | ||
$Name | string | The name of the configuration setting to get. If the setting is contained
within an associative array, use dot denomination to get the setting. ie.
$this->Get('Database.Host') would retrieve $Configuration[$Group]['Database']['Host'] . |
$DefaultValue | mixed | If the parameter is not found in the group, this value will be returned. |
리턴 | mixed | The configuration value. |
public getSortFlag ( ) : null | integer | ||
리턴 | null | integer | The sort flag to be used with ksort. |
public load ( string $File, string $Name = 'Configuration', boolean $Dynamic = false ) : boolean | ||
$File | string | A string containing the path to a file that contains the settings array. |
$Name | string | The name of the variable and initial group settings. Note: When $Name is 'Configuration' then the data will be set to the root of the config. |
$Dynamic | boolean | Optional, whether to treat this as the request's "dynamic" config, and to save config changes here. These settings will also be re-applied later when "OverlayDynamic" is called after all defaults are loaded. |
리턴 | boolean |
public loadArray ( string $ConfigData, string $Tag, string $Name = 'Configuration', boolean $Dynamic = true, $SaveCallback = null, $CallbackOptions = null ) : boolean | ||
$ConfigData | string | An array containing the configuration data |
$Tag | string | A string descriptor of this config set |
$Name | string | The name of the variable and initial group settings. Note: When $Name is 'Configuration' then the data will be set to the root of the config. |
$Dynamic | boolean | Optional, whether to treat this as the request's "dynamic" config, and to save config changes here. These settings will also be re-applied later when "OverlayDynamic" is called after all defaults are loaded. |
리턴 | boolean |
public loadString ( string $String, string $Tag, string $Name = 'Configuration', boolean $Dynamic = true, $SaveCallback = null, $CallbackOptions = null ) : boolean | ||
$String | string | A string containing the php settings array. |
$Tag | string | A string descriptor of this config set |
$Name | string | The name of the variable and initial group settings. Note: When $Name is 'Configuration' then the data will be set to the root of the config. |
$Dynamic | boolean | Optional, whether to treat this as the request's "dynamic" config, and to save config changes here. These settings will also be re-applied later when "OverlayDynamic" is called after all defaults are loaded. |
리턴 | boolean |
public massImport ( type $Data ) | ||
$Data | type |
protected static mergeConfig ( array &$Data, array $Loaded ) | ||
$Data | array | Reference to the current active state |
$Loaded | array | Data to merge |
public overlayDynamic ( ) |
public set ( string $Name, mixed $Value, boolean $Overwrite = true, $Save = true ) | ||
$Name | string | The name of the configuration setting to assign. If the setting is contained within an associative array, use dot denomination to get the setting. ie. $this->Set('Database.Host', $Value) would set $Configuration[$Group]['Database']['Host'] = $Value |
$Value | mixed | The value of the configuration setting. |
$Overwrite | boolean | If the setting already exists, should it's value be overwritten? Defaults to true. |
public setSortFlag ( integer $sortFlag ) : Gdn_Configuration | ||
$sortFlag | integer | As defined in php standard definitions |
리턴 | Gdn_Configuration | $this |
$this->_Data['Group0']['Group1']['ConfigurationName'] = 'Value';
public $Data |
protected $autoSave |
protected $dynamic |
protected $sources |