DataInterface
in
Table of Contents
Constants
Methods
- append() : void
- Append a value to a key (assumes key refers to an array value)
- export() : array<string, mixed>
- Export data as raw data
- get() : mixed
- Get the raw value for a key
- getData() : DataInterface
- Get a data instance for a key
- has() : bool
- Check if the key exists
- import() : void
- Import data into existing data
- importData() : void
- Import data from an external data into existing data
- remove() : void
- Remove a key
- set() : void
- Set a value for a key
Constants
MERGE
public
mixed
MERGE
= 2
PRESERVE
public
mixed
PRESERVE
= 0
REPLACE
public
mixed
REPLACE
= 1
Methods
append()
Append a value to a key (assumes key refers to an array value)
public
append(string $key[, mixed $value = null ]) : void
If the key does not yet exist it will be created. If the key references a non-array it's existing contents will be added into a new array before appending the new value.
Parameters
- $key : string
- $value : mixed = null
Tags
export()
Export data as raw data
public
export() : array<string, mixed>
Tags
Return values
array<string, mixed>get()
Get the raw value for a key
public
get(string $key[, mixed $default = null ]) : mixed
If the key does not exist, an optional default value can be returned instead. If no default is provided then an exception will be thrown instead.
Parameters
- $key : string
- $default : mixed = null
Tags
getData()
Get a data instance for a key
public
getData(string $key) : DataInterface
Parameters
- $key : string
Tags
Return values
DataInterfacehas()
Check if the key exists
public
has(string $key) : bool
Parameters
- $key : string
Tags
Return values
boolimport()
Import data into existing data
public
import(array<string, mixed> $data[, self::PRESERVE|self::REPLACE|self::MERGE $mode = self::REPLACE ]) : void
Parameters
- $data : array<string, mixed>
- $mode : self::PRESERVE|self::REPLACE|self::MERGE = self::REPLACE
importData()
Import data from an external data into existing data
public
importData(DataInterface $data[, self::PRESERVE|self::REPLACE|self::MERGE $mode = self::REPLACE ]) : void
Parameters
- $data : DataInterface
- $mode : self::PRESERVE|self::REPLACE|self::MERGE = self::REPLACE
remove()
Remove a key
public
remove(string $key) : void
No exception will be thrown if the key does not exist
Parameters
- $key : string
Tags
set()
Set a value for a key
public
set(string $key[, mixed $value = null ]) : void
If the key does not yet exist it will be created.
Parameters
- $key : string
- $value : mixed = null