EnvConfig
extends IniConfig
in package
The ini config class
This class uses ini files to get configuration.
Table of Contents
Properties
- $caching : bool
- The config uses cache
- $config : array<string|int, mixed>
- Contains the configuration for this Config Object.
- $extension : string
- $main : Config|null
- Contains the main ENV configuration
- $repositories : array<string|int, mixed>
- The repositories
Methods
- __get() : array<string|int, mixed>
- Return the configuration item with key $key.
- __isset() : mixed
- Checks if the config $key is set.
- __set() : mixed
- Sets the configuration item with key $key.
- add() : void
- Add configuration to this object
- asArray() : array<string|int, mixed>
- Get this config as array
- build() : Config|null
- buildAll() : Config|null
- buildFrom() : Config|null
- count() : int
- get() : mixed
- Get configuration from the main configuration object
- getArray() : array<string|int, mixed>
- getConfig() : Config|null
- getFilePath() : string|null
- getIterator() : Traversable
- getMain() : Config|null
- getOne() : mixed
- Get one config value
- hasSource() : bool
- Check if source is available
- isCaching() : bool
- Test if config is caching
- load() : bool
- Load new configuration from source
- loadFrom() : bool
- Load new configuration from source in package
- offsetExists() : bool
- offsetGet() : mixed
- offsetSet() : void
- offsetUnset() : void
- parse() : mixed
- Parse configuration from given source.
- set() : void
- Set configuration to the main configuration object Call __set() method to main configuration object.
- setCaching() : void
- Set if config is caching
- getSourcePath() : string
- normalizeName() : string
Properties
$caching
The config uses cache
protected
static bool
$caching
= true
$config
Contains the configuration for this Config Object.
protected
array<string|int, mixed>
$config
= []
Must be inherited from ConfigCore.
$extension
protected
static string
$extension
$main
Contains the main ENV configuration
protected
static Config|null
$main
= null
$repositories
The repositories
protected
static array<string|int, mixed>
$repositories
= []
Methods
__get()
Return the configuration item with key $key.
public
__get(string $key) : array<string|int, mixed>
Except for:
- 'all' : It returns an array containing all configuration items.
Parameters
- $key : string
-
The key to get the value
Return values
array<string|int, mixed> —A config value
__isset()
Checks if the config $key is set.
public
__isset(string $key) : mixed
Parameters
- $key : string
-
Key of the config to check is set
__set()
Sets the configuration item with key $key.
public
__set(string $key, mixed $value) : mixed
Except for:
- 'all' : It sets all the array containing all configuration items.
Parameters
- $key : string
-
The key to set the value
- $value : mixed
-
The new config value
add()
Add configuration to this object
public
add(array<string|int, mixed>|null $config) : void
Parameters
- $config : array<string|int, mixed>|null
-
The configuration array to add to the current object.
asArray()
Get this config as array
public
asArray() : array<string|int, mixed>
Return values
array<string|int, mixed>build()
public
static build(string $source[, bool $minor = false ][, bool $cached = true ]) : Config|null
Parameters
- $source : string
- $minor : bool = false
- $cached : bool = true
Return values
Config|nullbuildAll()
public
static buildAll() : Config|null
Return values
Config|nullbuildFrom()
public
static buildFrom(string|null $package, string $source[, bool $cached = true ][, bool $silent = false ]) : Config|null
Parameters
- $package : string|null
- $source : string
- $cached : bool = true
- $silent : bool = false
Return values
Config|nullcount()
public
count() : int
Return values
intget()
Get configuration from the main configuration object
public
static get(string $key[, mixed $default = null ]) : mixed
Parameters
- $key : string
-
The key to get the value
- $default : mixed = null
-
The default value to use
Return values
mixed —A config value
getArray()
public
abstract & getArray() : array<string|int, mixed>
Return values
array<string|int, mixed>getConfig()
public
static getConfig() : Config|null
Return values
Config|nullgetFilePath()
public
static getFilePath(string $source[, string|null $package = null ]) : string|null
Parameters
- $source : string
- $package : string|null = null
Return values
string|nullgetIterator()
public
getIterator() : Traversable
Return values
TraversablegetMain()
public
static getMain() : Config|null
Return values
Config|nullgetOne()
Get one config value
public
getOne(string $key[, mixed $default = null ]) : mixed
Parameters
- $key : string
- $default : mixed = null
hasSource()
Check if source is available
public
hasSource(string $source[, string|null $package = null ]) : bool
Parameters
- $source : string
-
An identifier to get the source
- $package : string|null = null
Return values
bool —True if source is available
isCaching()
Test if config is caching
public
static isCaching() : bool
Return values
boolload()
Load new configuration from source
public
load(string $source[, bool $cached = true ]) : bool
Parameters
- $source : string
-
An identifier to get the source
- $cached : bool = true
-
True if this configuration should be cached
Return values
bool —True if this configuration was loaded successfully
loadFrom()
Load new configuration from source in package
public
loadFrom(string|null $package, string $source[, bool $cached = true ]) : bool
Parameters
- $package : string|null
-
The package to include config (null to get app config)
- $source : string
-
An identifier to get the source
- $cached : bool = true
-
True if this configuration should be cached
Return values
bool —True if this configuration was loaded successfully
offsetExists()
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
booloffsetGet()
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
offsetSet()
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
offsetUnset()
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
parse()
Parse configuration from given source.
public
static parse(string $path) : mixed
Parameters
- $path : string
-
The path to the config file
Return values
mixed —The loaded configuration array
set()
Set configuration to the main configuration object Call __set() method to main configuration object.
public
static set(string $key, mixed $value) : void
Parameters
- $key : string
-
The key to set the value
- $value : mixed
-
The new config value
Tags
setCaching()
Set if config is caching
public
static setCaching(bool $caching) : void
Parameters
- $caching : bool
getSourcePath()
protected
static getSourcePath(string $source) : string
Parameters
- $source : string
Return values
stringnormalizeName()
protected
normalizeName(string $name) : string
Parameters
- $name : string