PHP Класс 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.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$configurations array
$logger Logger

Открытые методы

Метод Описание
README ( ) : string
__construct ( ) Instantiate instance configured to load configurations based on called class name
configure ( string $path )

Защищенные методы

Метод Описание
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

Приватные методы

Метод Описание
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

Описание методов

README() абстрактный публичный Метод

abstract public README ( ) : string
Результат string Sample of how configuration is intended to be defined

__construct() публичный Метод

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

configsPath() защищенный Метод

protected configsPath ( ) : string
Результат string Path to configurations

configure() публичный статический Метод

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

getArray() защищенный Метод

protected getArray ( $section, $key, array $default = [], $required = true ) : string[]
$default array
Результат string[] String list of value split by comma

getBool() защищенный Метод

protected getBool ( $section, $key, $default = null, $required = true ) : boolean
Результат boolean If the value equals the literal string "true"

getCurrentPassword() защищенный Метод

Prompt user for their user account's password
protected getCurrentPassword ( string $prompt ) : string
$prompt string Text to prompt the user
Результат string Current user's password

getCurrentUsername() защищенный Метод

protected getCurrentUsername ( ) : string
Результат string User name of effective user

getNumeric() защищенный Метод

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

getSecret() защищенный Метод

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
Результат string Secret input from user

getValue() защищенный Метод

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
Результат mixed Configured value or default

loadParsedIni() защищенный Метод

protected loadParsedIni ( string $filePath, string $subclass ) : array
$filePath string Absolute path to file containing configurations
$subclass string Name of the configuration class
Результат array Contents of configuration parsed as INI with sections

Описание свойств

$configurations защищенное свойство

protected array $configurations
Результат array

$logger защищенное свойство

protected Logger $logger
Результат Logger