class Data implements DataInterface, IteratorAggregate, ArrayAccess, Countable (View source)

Data object to store values.

Methods

__construct(mixed $data = null)

Constructor.

bind(mixed $values, boolean $replaceNulls = false)

Bind the data into this object.

set(string $field, mixed $value = null)

Set value to Data object.

mixed
get(string $field, mixed $default = null)

Get value.

boolean
exists(string $field)

Method to check a field exists.

void
__set(string $field, mixed $value = null)

Set value.

boolean
__isset(string $field)

__isset

mixed
__get(string $field)

Get value.

void
__unset(string $name)

__unset

getIterator()

Retrieve an external iterator

boolean
offsetExists(mixed $offset)

Is a property exists or not.

mixed
offsetGet(mixed $offset)

Get a property.

void
offsetSet(mixed $offset, mixed $value)

Set a value to property.

void
offsetUnset(mixed $offset)

Unset a property.

int
count()

Count this object.

boolean
isNull()

Is this object empty?

boolean
notNull()

Is this object has properties?

array
dump()

Dump all data as array

map(callable $callback)

Mapping all elements.

walk(callable $callback, mixed $userdata = null)

Apply a user supplied function to every member of this object.

void
__clone()

Clone this object.

Details

at line line 23
__construct(mixed $data = null)

Constructor.

Parameters

mixed $data

at line line 41
Data bind(mixed $values, boolean $replaceNulls = false)

Bind the data into this object.

Parameters

mixed $values The data array or object.
boolean $replaceNulls Replace null or not.

Return Value

Data Return self to support chaining.

Exceptions

InvalidArgumentException

at line line 89
Data set(string $field, mixed $value = null)

Set value to Data object.

Parameters

string $field The field to set.
mixed $value The value to set.

Return Value

Data Return self to support chaining.

Exceptions

InvalidArgumentException

at line line 110
mixed get(string $field, mixed $default = null)

Get value.

Parameters

string $field The field to get.
mixed $default The default value if not exists.

Return Value

mixed The value we want ot get.

Exceptions

InvalidArgumentException

at line line 127
boolean exists(string $field)

Method to check a field exists.

Parameters

string $field The field name to check.

Return Value

boolean True if exists.

at line line 147
void __set(string $field, mixed $value = null)

Set value.

Parameters

string $field The field to set.
mixed $value The value to set.

Return Value

void

Exceptions

InvalidArgumentException

at line line 159
boolean __isset(string $field)

__isset

Parameters

string $field

Return Value

boolean

at line line 171
mixed __get(string $field)

Get value.

Parameters

string $field The field to get.

Return Value

mixed

at line line 183
void __unset(string $name)

__unset

Parameters

string $name

Return Value

void

at line line 193
Traversable getIterator()

Retrieve an external iterator

Return Value

Traversable An instance of an object implementing Iterator or Traversable

at line line 205
boolean offsetExists(mixed $offset)

Is a property exists or not.

Parameters

mixed $offset Offset key.

Return Value

boolean

at line line 218
mixed offsetGet(mixed $offset)

Get a property.

Parameters

mixed $offset Offset key.

Return Value

mixed The value to return.

Exceptions

InvalidArgumentException

at line line 232
void offsetSet(mixed $offset, mixed $value)

Set a value to property.

Parameters

mixed $offset Offset key.
mixed $value The value to set.

Return Value

void

Exceptions

InvalidArgumentException

at line line 245
void offsetUnset(mixed $offset)

Unset a property.

Parameters

mixed $offset Offset key to unset.

Return Value

void

Exceptions

InvalidArgumentException

at line line 261
int count()

Count this object.

Return Value

int

at line line 271
boolean isNull()

Is this object empty?

Return Value

boolean

at line line 281
boolean notNull()

Is this object has properties?

Return Value

boolean

at line line 291
array dump()

Dump all data as array

Return Value

array

at line line 305
Data map(callable $callback)

Mapping all elements.

Parameters

callable $callback Callback to handle every element.

Return Value

Data Support chaining.

at line line 325
Data walk(callable $callback, mixed $userdata = null)

Apply a user supplied function to every member of this object.

Parameters

callable $callback Callback to handle every element.
mixed $userdata This will be passed as the third parameter to the callback.

Return Value

Data Support chaining.

at line line 344
void __clone()

Clone this object.

Return Value

void