PHP Class Gdn_ConfigurationSource, vanilla

Inheritance: extends Gdn_Pluggable
Mostrar archivo Open project: vanilla/vanilla Class Usage Examples

Protected Properties

Property Type Description
$Callback Save callback.
$CallbackOptions Save callback options.
$Configuration Top level configuration object to reference.
$Dirty Whether this config source has been modified since loading.
$Group Group name for this config source (e.g. Configuration).
$Initial Settings as they were when loaded (to facilitate logging config change diffs).
$Settings Current array of live config settings for this source.
$Source Name of source (e.g. filename, or string source tag).
$Splitting Allow key splitting on dots.
$Type Type of source (e.g. file or string).

Public Methods

Method Description
__construct ( $Configuration, $Type, $Source, $Group, $Settings )
assignCallback ( callback $Callback, array $Options = null ) : boolean Set a save callback
export ( ) : array
fromArray ( Gdn_Configuration $Parent, array $ConfigData, string $Tag, string $Name = 'Configuration' ) : Gdn_ConfigurationSource Load config data from an array
fromFile ( Gdn_Configuration $Parent, string $File, string $Name = 'Configuration' ) : Gdn_ConfigurationSource Load config data from a file.
fromString ( Gdn_Configuration $Parent, string $String, string $Tag, string $Name = 'Configuration' ) : Gdn_ConfigurationSource Load config data from a string
get ( string $Name, mixed $DefaultValue = false ) : mixed Gets a setting from the configuration array. Returns $DefaultValue if the value isn't found.
group ( ) : string
identify ( ) : string
import ( $Settings )
massImport ( type $Data ) Import a large pre-formatted set of configs efficiently
parseString ( $String, $Name ) : boolean
remove ( string $Name ) : boolean Removes the specified key from the config (if it exists).
save ( ) : boolean | null
set ( $Name, null $Value = null, boolean $Overwrite = true )
shutdown ( )
splitting ( boolean $Splitting = true )
toFile ( $File )

Method Details

__construct() public method

public __construct ( $Configuration, $Type, $Source, $Group, $Settings )
$Configuration
$Type
$Source
$Group
$Settings

assignCallback() public method

Set a save callback
public assignCallback ( callback $Callback, array $Options = null ) : boolean
$Callback callback
$Options array Callback options
return boolean

export() public method

public export ( ) : array
return array

fromArray() public static method

Load config data from an array
public static fromArray ( Gdn_Configuration $Parent, array $ConfigData, string $Tag, string $Name = 'Configuration' ) : Gdn_ConfigurationSource
$Parent Gdn_Configuration Parent config object
$ConfigData array Config data array
$Tag string Internal friendly name
$Name string Optional setting name
return Gdn_ConfigurationSource

fromFile() public static method

Load config data from a file.
public static fromFile ( Gdn_Configuration $Parent, string $File, string $Name = 'Configuration' ) : Gdn_ConfigurationSource
$Parent Gdn_Configuration Parent config object
$File string Path to config file to load
$Name string Optional setting name
return Gdn_ConfigurationSource

fromString() public static method

Load config data from a string
public static fromString ( Gdn_Configuration $Parent, string $String, string $Tag, string $Name = 'Configuration' ) : Gdn_ConfigurationSource
$Parent Gdn_Configuration Parent config object
$String string Config data string
$Tag string Internal friendly name
$Name string Optional setting name
return Gdn_ConfigurationSource

get() public method

Gets a setting from the configuration array. Returns $DefaultValue if the value isn't found.
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.
return mixed The configuration value.

group() public method

public group ( ) : string
return string

identify() public method

public identify ( ) : string
return string

import() public method

public import ( $Settings )
$Settings

massImport() public method

NOTE: ONLY WORKS WHEN SPLITTING IS OFF!
public massImport ( type $Data )
$Data type

parseString() public static method

public static parseString ( $String, $Name ) : boolean
$String
$Name
return boolean

remove() public method

Returns false if the key is not found for removal, true otherwise.
public remove ( string $Name ) : boolean
$Name string The name of the configuration setting with dot notation.
return boolean Whether or not the key was found.

save() public method

public save ( ) : boolean | null
return boolean | null

set() public method

public set ( $Name, null $Value = null, boolean $Overwrite = true )
$Name
$Value null
$Overwrite boolean

shutdown() public method

public shutdown ( )

splitting() public method

public splitting ( boolean $Splitting = true )
$Splitting boolean

toFile() public method

public toFile ( $File )
$File

Property Details

$Callback protected_oe property

Save callback.
protected $Callback

$CallbackOptions protected_oe property

Save callback options.
protected $CallbackOptions

$Configuration protected_oe property

Top level configuration object to reference.
protected $Configuration

$Dirty protected_oe property

Whether this config source has been modified since loading.
protected $Dirty

$Group protected_oe property

Group name for this config source (e.g. Configuration).
protected $Group

$Initial protected_oe property

Settings as they were when loaded (to facilitate logging config change diffs).
protected $Initial

$Settings protected_oe property

Current array of live config settings for this source.
protected $Settings

$Source protected_oe property

Name of source (e.g. filename, or string source tag).
protected $Source

$Splitting protected_oe property

Allow key splitting on dots.
protected $Splitting

$Type protected_oe property

Type of source (e.g. file or string).
protected $Type