ACTION_NONE
ACTION_NONE = 0
Disallow all actions
Recursive registry functionality.
$registry = new \donbidon\Core\Registry\Recursive([
'key_1' => "value_1",
'key_2' => [
'key_2_1' => "value_2_1",
'key_2_2' => "value_2_2",
],
'key_3' => "~~> key_2/key_2_2",
]);
var_dump($registry->exists('key_1'));
var_dump($registry->exists('key_2/key_2_3'));
var_dump($registry->get('key_3'));
outputs
bool(true)
bool(false)
string(9) "value_2_2"
_get(string $key = null, mixed $default = null, boolean $throw = true) : mixed
Short alias for self::getInstance()->get().
string | $key | |
mixed | $default | |
boolean | $throw | Throw exception if no default value passed and key doesn't exist |
Risen from self::get().
__construct(array $scope = array(), integer $options = self::ALL_INCLUSIVE, string $delimiter = '/')
Constructor.
Example:
use donbidon\Core\Registry\Common;
// Create registry allowing to add new keys only
$registry = new Common(
[
'key_1' => "value_1",
],
Common::ACTION_CREATE
);
$registry->set('key_2', "value_2"); // Ok
// RuntimeException having Registry:ACTION_CREATE
// code will be thrown.
$registry->set('key_2', "value_2*");
array | $scope | |
integer | $options | Combination of the following flags:
|
string | $delimiter | Key delimiter |