PHP 클래스 Gush\Config

Configuration is stored per type: system and local, and is always merged into the "all" type which is only used for getting and not setting. Note that the Config class does not check if the provided directories are valid or even exist. This class is only for holding configuration.
파일 보기 프로젝트 열기: gushphp/gush 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( $homedir, array $config = [], $localHome = null, array $localConfig = [] )
get ( string | string[] $keys, string $type = self::CONFIG_ALL, string | integer | float | boolean | array $default = null ) : string | integer | float | boolean | array Returns a config value.
getFirstNotNull ( array $keys, string $type = self::CONFIG_ALL, string | integer | float | boolean | array $default = null ) : string | integer | float | boolean | array Returns the first none-null configuration value.
has ( string $key, string $type = self::CONFIG_ALL ) : boolean Checks whether the config exists.
merge ( array $config, $type ) Merges new config values with the existing ones (overriding).
set ( string $key, string | integer | float | boolean | array $value, string $type ) : Config Merges new config values with the existing ones (overriding).
toArray ( string $type = self::CONFIG_ALL ) : array Get the configuration is as array.

비공개 메소드들

메소드 설명
guardConfigSlot ( string $type ) Guard the configuration slot is valid.

메소드 상세

__construct() 공개 메소드

public __construct ( $homedir, array $config = [], $localHome = null, array $localConfig = [] )
$config array
$localConfig array

get() 공개 메소드

Returns a config value.
public get ( string | string[] $keys, string $type = self::CONFIG_ALL, string | integer | float | boolean | array $default = null ) : string | integer | float | boolean | array
$keys string | string[] Single level key like 'adapters' or array-path like ['adapters', 'github']
$type string Either Config::CONFIG_SYSTEM Config::CONFIG_LOCAL or Config::CONFIG_ALL
$default string | integer | float | boolean | array Default value to use when no config is found (null)
리턴 string | integer | float | boolean | array

getFirstNotNull() 공개 메소드

Returns the first none-null configuration value.
public getFirstNotNull ( array $keys, string $type = self::CONFIG_ALL, string | integer | float | boolean | array $default = null ) : string | integer | float | boolean | array
$keys array Array of single level keys like "adapters" or property-path "[adapters][github]" to check
$type string Either Config::CONFIG_SYSTEM Config::CONFIG_LOCAL or Config::CONFIG_ALL
$default string | integer | float | boolean | array Default value to use when no config is found (null)
리턴 string | integer | float | boolean | array

has() 공개 메소드

Note. A value with null is considered undefined.
public has ( string $key, string $type = self::CONFIG_ALL ) : boolean
$key string Single level key like "adapters" or property-path "[adapters][github]"
$type string Either Config::CONFIG_SYSTEM Config::CONFIG_LOCAL or Config::CONFIG_ALL
리턴 boolean

merge() 공개 메소드

Merges new config values with the existing ones (overriding).
public merge ( array $config, $type )
$config array

set() 공개 메소드

This can only store a single-key level like "adapters" but not "[adapters][github]".
public set ( string $key, string | integer | float | boolean | array $value, string $type ) : Config
$key string Single level config key
$value string | integer | float | boolean | array Value to store
$type string Either Config::CONFIG_SYSTEM or Config::CONFIG_LOCAL
리턴 Config

toArray() 공개 메소드

Get the configuration is as array.
public toArray ( string $type = self::CONFIG_ALL ) : array
$type string Either Config::CONFIG_SYSTEM Config::CONFIG_LOCAL or Config::CONFIG_ALL
리턴 array