Configuration
class Configuration extends Collection
Class Configuration - 配置数据管理
Constants
FORMAT_JSON |
|
FORMAT_PHP |
|
FORMAT_INI |
|
FORMAT_YML |
|
MODE_DATA |
|
MODE_FOLDER |
|
Properties
protected array | $data | The source data | from SimpleCollection |
protected string | $separator | Property separator. | from Collection |
protected string | $name | name | from Collection |
static protected array | $formats | formats | from Collection |
protected string | $mode | config mode Allow: folder 文件夹模式,传入一个配置文件夹路径,根据文件夹中的配置名称读取配置数据 data 数据模式,可以一个配置文件的路径,将会自动读取载入;或直接传入数组数据 | |
protected string | $format |
Methods
No description
__construct
set config value by path
get value by path
No description
No description
No description
parse YAML
get Mode
No description
No description
data is Readonly
No description
No description
No description
No description
Details
in Collection at line 94
static SimpleCollection
make(mixed $data = null, string $format = 'php', string $name = 'box1')
at line 61
__construct(mixed $data = null, string $format = self::FORMAT_PHP, string $name = 'config')
__construct
in SimpleCollection at line 40
__destruct()
at line 85
set(string $path, $value)
set config value by path
in SimpleCollection at line 67
$this
add($name, $value)
at line 102
get(string $path, $default = null)
get value by path
in SimpleCollection at line 91
replace(array $items)
Add item to collection
in SimpleCollection at line 102
array
gets(array $names)
in SimpleCollection at line 117
SimpleCollection
sets(array $data)
in SimpleCollection at line 130
SimpleCollection
reject(callable $filter)
in SimpleCollection at line 149
SimpleCollection
map(callable $callback)
in SimpleCollection at line 165
string
implode(string $char = ',')
in SimpleCollection at line 174
array
all()
Get all items in collection
in SimpleCollection at line 182
array
toArray()
in SimpleCollection at line 191
array
keys()
Get collection keys
in Collection at line 132
bool
has(string $path)
in SimpleCollection at line 211
mixed
remove($key)
Remove item from collection
in Collection at line 148
clear()
Clear all data.
in SimpleCollection at line 240
bool
offsetExists(string $key)
Does this collection have a given key?
in SimpleCollection at line 250
mixed
offsetGet(string $key)
Get collection item for key
in SimpleCollection at line 260
offsetSet(string $key, mixed $value)
Set collection item
in Collection at line 377
mixed|null
offsetUnset(mixed $offset)
Unset an offset in the iterator.
in SimpleCollection at line 283
int
count()
Get number of items in collection
in SimpleCollection at line 295
array
jsonSerialize()
in SimpleCollection at line 307
string
serialize()
in SimpleCollection at line 316
unserialize(string $serialized, bool|array $allowedClasses = false)
in Collection at line 367
ArrayIterator
getIterator()
in SimpleCollection at line 342
mixed
__get($name)
in SimpleCollection at line 347
__set($name, $value)
in SimpleCollection at line 352
__isset($name)
in Collection at line 123
exists($path)
in Collection at line 137
reset()
in Collection at line 157
mixed
toObject($class = \stdClass::class)
in Collection at line 165
string
getSeparator()
in Collection at line 173
setSeparator(string $separator)
in Collection at line 181
static array
getFormats()
in Collection at line 191
$this
setName(string $value)
setName
in Collection at line 202
string
getName()
getName
in Collection at line 215
Collection
load(string|array $data, string $format = 'php')
load
in Collection at line 253
static array|mixed
read($file, string $format = self::FORMAT_PHP)
in Collection at line 264
Collection
loadYaml($data)
load data form yml file
in Collection at line 275
Collection
loadArray(array|string $data)
load data form php file or array
in Collection at line 294
Collection
loadObject(mixed $data)
load data form php file or array
in Collection at line 308
Collection
loadIni(string $string)
load data form ini file
in Collection at line 319
Collection
loadJson($data)
load data form json file
in Collection at line 330
protected $this
bindData($parent, $data, bool|false $raw = false)
in Collection at line 359
array
getKeys()
in Collection at line 382
__clone()
in Collection at line 398
static array
parseIni($string, bool $enhancement = false, callable $pathHandler = null, string $fileDir = '')
in Collection at line 410
static array
parseJson($data, bool $enhancement = false, callable $pathHandler = null, string $fileDir = '')
in Collection at line 423
static array
parseYaml(string|bool $data, bool $enhancement = false, callable $pathHandler = null, string $fileDir = '')
parse YAML
at line 127
string
getMode()
get Mode
at line 135
setMode(string $mode)
at line 143
setReadonly(bool $readonly)
at line 152
boolean
isReadonly()
data is Readonly