PHP Class Bart\Configuration\Configuration

All children are required to define a README method which can be used to see how each class expects its conf files to look.
Afficher le fichier Open project: box/bart Class Usage Examples

Protected Properties

Свойство Type Description
$configurations array
$logger Logger

Méthodes publiques

Méthode Description
README ( ) : string
__construct ( ) Instantiate instance configured to load configurations based on called class name
configure ( string $path )

Méthodes protégées

Méthode Description
configsPath ( ) : string
getArray ( $section, $key, array $default = [], $required = true ) : string[]
getBool ( $section, $key, $default = null, $required = true ) : boolean
getCurrentPassword ( string $prompt ) : string Prompt user for their user account's password
getCurrentUsername ( ) : string
getNumeric ( $section, $key, $default = null, $required = true ) http://stackoverflow.com/questions/12650802/php-equivalent-of-javascripts-parseint-function
getSecret ( string $section, string $key, string $prompt ) : string Prompt the user for secret input. Secret is cached in $section.$key for later retrieval.
getValue ( string $section, string $key, mixed $default = null, boolean $required = true ) : mixed
loadParsedIni ( string $filePath, string $subclass ) : array

Private Methods

Méthode Description
load ( ) : array Load the configurations from the config file for subclass
updateRuntimeConfiguration ( string $section, string $key, string $value ) Set in memory configs for $section[$key] = $value; this is used exclusively for caching secrets

Method Details

README() abstract public méthode

abstract public README ( ) : string
Résultat string Sample of how configuration is intended to be defined

__construct() public méthode

Instantiate instance configured to load configurations based on called class name
public __construct ( )

configsPath() protected méthode

protected configsPath ( ) : string
Résultat string Path to configurations

configure() public static méthode

public static configure ( string $path )
$path string Root path to all configuration

getArray() protected méthode

protected getArray ( $section, $key, array $default = [], $required = true ) : string[]
$default array
Résultat string[] String list of value split by comma

getBool() protected méthode

protected getBool ( $section, $key, $default = null, $required = true ) : boolean
Résultat boolean If the value equals the literal string "true"

getCurrentPassword() protected méthode

Prompt user for their user account's password
protected getCurrentPassword ( string $prompt ) : string
$prompt string Text to prompt the user
Résultat string Current user's password

getCurrentUsername() protected méthode

protected getCurrentUsername ( ) : string
Résultat string User name of effective user

getNumeric() protected méthode

http://stackoverflow.com/questions/12650802/php-equivalent-of-javascripts-parseint-function
protected getNumeric ( $section, $key, $default = null, $required = true )

getSecret() protected méthode

Prompt the user for secret input. Secret is cached in $section.$key for later retrieval.
protected getSecret ( string $section, string $key, string $prompt ) : string
$section string Section in which to use key to save secret in cache only
$key string Key name to associate with secret in cache only
$prompt string Text to prompt user input
Résultat string Secret input from user

getValue() protected méthode

protected getValue ( string $section, string $key, mixed $default = null, boolean $required = true ) : mixed
$section string Configuration section in file
$key string Configuration key in section
$default mixed If not required, the default to use
$required boolean If an exception should be raised when value is missing
Résultat mixed Configured value or default

loadParsedIni() protected méthode

protected loadParsedIni ( string $filePath, string $subclass ) : array
$filePath string Absolute path to file containing configurations
$subclass string Name of the configuration class
Résultat array Contents of configuration parsed as INI with sections

Property Details

$configurations protected_oe property

protected array $configurations
Résultat array

$logger protected_oe property

protected Logger $logger
Résultat Logger