Represents a collection of keys and values.
OMV\Dictionary::__construct |
( |
array |
$data = [] | ) |
|
Constructor.
- Parameters
-
data | The associative array containing the data. |
OMV\Dictionary::assertExists |
( |
|
$key | ) |
|
Assert that the specified key exists.
- Parameters
-
key | The key in dot notation, e.g. 'a.b.c'. |
- Returns
- None.
- Exceptions
-
OMV\Dictionary::assertValidKey |
( |
|
$key | ) |
|
|
protected |
Assert that the given key is valid.
- Parameters
-
key | The key in dot notation, e.g. 'a.b.c'. |
- Returns
- None.
- Exceptions
-
OMV\Dictionary::copy |
( |
|
$srcKey, |
|
|
|
$destKey |
|
) |
| |
Copy a key.
- Parameters
-
srcKey | The source key in dot notation, e.g. 'a.b.c'. |
destKey | The destination key in dot notation, e.g. 'a.b.c'. |
- Returns
- None.
OMV\Dictionary::exists |
( |
|
$key | ) |
|
Check whether the specified key exists.
- Parameters
-
key | The key in dot notation, e.g. 'a.b.c'. |
- Returns
- Returns TRUE if the key exists, otherwise FALSE.
OMV\Dictionary::fromJson |
( |
|
$json = "" | ) |
|
Import JSON data.
- Parameters
-
- Returns
- None.
OMV\Dictionary::get |
( |
|
$key, |
|
|
|
$default = NULL |
|
) |
| |
Get the value for a key.
- Parameters
-
key | The key in dot notation, e.g. 'a.b.c'. |
default | The optional default value. |
- Returns
- The requested value.
OMV\Dictionary::getData |
( |
| ) |
|
Get the whole data.
- Returns
- The whole data.
OMV\Dictionary::isValidKey |
( |
|
$key | ) |
|
|
protected |
Check whether the given key is valid.
- Parameters
-
key | The key in dot notation, e.g. 'a.b.c' or 'a.b.0.c.1' |
- Returns
- Returns TRUE if the key is valid, otherwise FALSE.
OMV\Dictionary::remove |
( |
|
$key | ) |
|
Remove a key.
- Parameters
-
key | The key in dot notation, e.g. 'a.b.c'. |
- Returns
- None.
OMV\Dictionary::set |
( |
|
$key, |
|
|
|
$value |
|
) |
| |
Set a value for a key.
- Parameters
-
key | The key in dot notation, e.g. 'a.b.c'. |
value | The value of the given key. |
- Returns
- None.
OMV\Dictionary::toJson |
( |
| ) |
|
Convert the data to JSON.
- Returns
- JSON serialized data.
The documentation for this class was generated from the following file: