Conf
in package
Config data
Tags
Table of Contents
- APP_HTTP_PATH_STRING = '@app-http-path'
- Built-in constants
- MEZON_HTTP_PATH_STRING = '@mezon-http-path'
- Built-in constants
- $appConfig : array<string, string|object|array|mixed>
- Config data
- addConfigValue() : void
- Function adds specified value $value into array with path $route in the config
- addConnectionToConfig() : void
- Method sets connection details to config
- clear() : void
- Method clears config data
- configKeyExists() : bool
- Validating key existance
- deleteConfigValue() : bool
- Deleting config value
- expandArrayValue() : array<string|int, mixed>
- Method expands arrays
- expandObjectValue() : object
- Method expands objects
- expandString() : mixed
- Method expands string
- expandStringValue() : string
- Method expands string
- getConfigValueAsArray() : array<string|int, mixed>
- Function returns specified config key If the key does not exists then $defaultValue will be returned
- getConfigValueAsObject() : object|null
- Function returns specified config key If the key does not exists then $defaultValue will be returned
- getConfigValueAsString() : string
- Function returns specified config key If the key does not exists then $defaultValue will be returned
- getValue() : mixed|null
- Method gts value of any type from config
- getValueAsArray() : array<string|int, mixed>
- Method returns config item as string
- getValueAsBool() : bool
- Method returns config item as string
- getValueAsObject() : object|null
- Method returns config item as string
- getValueAsString() : string
- Method returns config item as string
- loadConfigFromJson() : void
- Method loads config from JSON file
- setConfigArrayValue() : void
- Function sets specified config key with value $value
- setConfigBoolValue() : void
- Function sets specified config key with value $value
- setConfigObjectValue() : void
- Function sets specified config key with value $value
- setConfigStringValue() : void
- Function sets specified config key with value $value
- setConfigValue() : void
- Function sets specified config key with value $value
- setConfigValues() : void
- Function sets specified $settings
Constants
APP_HTTP_PATH_STRING
Built-in constants
public
mixed
APP_HTTP_PATH_STRING
= '@app-http-path'
MEZON_HTTP_PATH_STRING
Built-in constants
public
mixed
MEZON_HTTP_PATH_STRING
= '@mezon-http-path'
Properties
$appConfig
Config data
public
static array<string, string|object|array|mixed>
$appConfig
= []
Methods
addConfigValue()
Function adds specified value $value into array with path $route in the config
public
static addConfigValue(string $route, mixed $value) : void
Parameters
- $route : string
-
Route to key
- $value : mixed
-
Value to be set
Return values
void —addConnectionToConfig()
Method sets connection details to config
public
static addConnectionToConfig(string $name, string $dsn, string $user, string $password) : void
Parameters
- $name : string
-
config key
- $dsn : string
-
DSN
- $user : string
-
DB User login
- $password : string
-
DB User password
Return values
void —clear()
Method clears config data
public
static clear() : void
Return values
void —configKeyExists()
Validating key existance
public
static configKeyExists(string|array<string|int, string> $route) : bool
Parameters
- $route : string|array<string|int, string>
-
route to key
Return values
bool —true if the key exists, false otherwise
deleteConfigValue()
Deleting config value
public
static deleteConfigValue(string $route) : bool
Parameters
- $route : string
-
route to key
Return values
bool —true if the key was deleted, false otherwise
expandArrayValue()
Method expands arrays
public
static expandArrayValue(array<string|int, mixed> $value) : array<string|int, mixed>
Parameters
- $value : array<string|int, mixed>
-
value to be expanded
Return values
array<string|int, mixed> —expanded value
expandObjectValue()
Method expands objects
public
static expandObjectValue(object $value) : object
Parameters
- $value : object
-
value to be expanded
Return values
object —expanded value
expandString()
Method expands string
public
static expandString(object|string|array<string|int, mixed>|mixed $value) : mixed
Parameters
- $value : object|string|array<string|int, mixed>|mixed
-
value to be expanded
Return values
mixed —expanded value
expandStringValue()
Method expands string
public
static expandStringValue(string $value) : string
Parameters
- $value : string
-
value to be expanded
Return values
string —expanded value
getConfigValueAsArray()
Function returns specified config key If the key does not exists then $defaultValue will be returned
public
static getConfigValueAsArray(string $route[, array<string|int, mixed> $defaultValue = [] ]) : array<string|int, mixed>
Parameters
- $route : string
-
key route in config
- $defaultValue : array<string|int, mixed> = []
-
default value if the key was not found
Return values
array<string|int, mixed> —key value
getConfigValueAsObject()
Function returns specified config key If the key does not exists then $defaultValue will be returned
public
static getConfigValueAsObject(string $route[, object|null $defaultValue = null ]) : object|null
Parameters
- $route : string
-
key route in config
- $defaultValue : object|null = null
-
default value if the key was not found
Return values
object|null —key value
getConfigValueAsString()
Function returns specified config key If the key does not exists then $defaultValue will be returned
public
static getConfigValueAsString(string $route[, string $defaultValue = '' ]) : string
Parameters
- $route : string
-
key route in config
- $defaultValue : string = ''
-
default value if the key was not found
Return values
string —key value
getValue()
Method gts value of any type from config
public
static getValue(string $route[, mixed|null $defaultValue = null ]) : mixed|null
Parameters
- $route : string
-
key of the getting value
- $defaultValue : mixed|null = null
-
default value
Return values
mixed|null —config value
getValueAsArray()
Method returns config item as string
public
static getValueAsArray(string $route[, array<string|int, mixed> $defaultValue = [] ]) : array<string|int, mixed>
Parameters
- $route : string
-
key
- $defaultValue : array<string|int, mixed> = []
Return values
array<string|int, mixed> —value
getValueAsBool()
Method returns config item as string
public
static getValueAsBool(string $route[, bool $defaultValue = false ]) : bool
Parameters
- $route : string
-
key
- $defaultValue : bool = false
Return values
bool —value
getValueAsObject()
Method returns config item as string
public
static getValueAsObject(string $route[, object|null $defaultValue = null ]) : object|null
Parameters
- $route : string
-
key
- $defaultValue : object|null = null
Return values
object|null —value
getValueAsString()
Method returns config item as string
public
static getValueAsString(string $route[, string $defaultValue = '' ]) : string
Parameters
- $route : string
-
key
- $defaultValue : string = ''
Return values
string —value
loadConfigFromJson()
Method loads config from JSON file
public
static loadConfigFromJson(string $path) : void
Parameters
- $path : string
-
path to the config
Return values
void —setConfigArrayValue()
Function sets specified config key with value $value
public
static setConfigArrayValue(string $route, array<string|int, mixed> $value) : void
Parameters
- $route : string
-
route to key
- $value : array<string|int, mixed>
-
value to be set
Return values
void —setConfigBoolValue()
Function sets specified config key with value $value
public
static setConfigBoolValue(string $route, bool $value) : void
Parameters
- $route : string
-
route to key
- $value : bool
-
value to be set
Return values
void —setConfigObjectValue()
Function sets specified config key with value $value
public
static setConfigObjectValue(string $route, object $value) : void
Parameters
- $route : string
-
route to key
- $value : object
-
value to be set
Return values
void —setConfigStringValue()
Function sets specified config key with value $value
public
static setConfigStringValue(string $route, string $value) : void
Parameters
- $route : string
-
route to key
- $value : string
-
value to be set
Return values
void —setConfigValue()
Function sets specified config key with value $value
public
static setConfigValue(string $route, mixed $value) : void
Parameters
- $route : string
-
route to key
- $value : mixed
-
value to be set
Return values
void —setConfigValues()
Function sets specified $settings
public
static setConfigValues(array<string, string|object|array|mixed> $settings) : void
Parameters
- $settings : array<string, string|object|array|mixed>
-
pair of routes and values