PHP Class Gdn_ConfigurationSource, vanilla

Inheritance: extends Gdn_Pluggable
Afficher le fichier Open project: vanilla/vanilla Class Usage Examples

Protected Properties

Свойство 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).

Méthodes publiques

Méthode 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 méthode

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

assignCallback() public méthode

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

export() public méthode

public export ( ) : array
Résultat array

fromArray() public static méthode

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
Résultat Gdn_ConfigurationSource

fromFile() public static méthode

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
Résultat Gdn_ConfigurationSource

fromString() public static méthode

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
Résultat Gdn_ConfigurationSource

get() public méthode

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.
Résultat mixed The configuration value.

group() public méthode

public group ( ) : string
Résultat string

identify() public méthode

public identify ( ) : string
Résultat string

import() public méthode

public import ( $Settings )
$Settings

massImport() public méthode

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

parseString() public static méthode

public static parseString ( $String, $Name ) : boolean
$String
$Name
Résultat boolean

remove() public méthode

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.
Résultat boolean Whether or not the key was found.

save() public méthode

public save ( ) : boolean | null
Résultat boolean | null

set() public méthode

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

shutdown() public méthode

public shutdown ( )

splitting() public méthode

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

toFile() public méthode

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