class DataSet implements DataSetInterface, IteratorAggregate, ArrayAccess, Serializable, Countable, JsonSerializable (View source)

The Data set to store multiple data.

Methods

__construct(mixed $data = null)

Constructor.

bind(array $dataset)

Bind data array into self.

array
__get(string $property)

The magic get method is used to get a list of properties from the objects in the data set.

boolean
__isset(string $property)

The magic isset method is used to check the state of an object property using the iterator.

void
__set(string $property, mixed $value)

The magic set method is used to set an object property using the iterator.

void
__unset(string $property)

The magic unset method is used to unset an object property using the iterator.

boolean
offsetExists(mixed $offset)

Property is exist or not.

mixed
offsetGet(mixed $offset)

Get a value of property.

clear()

Clears the objects in the data set.

void
offsetSet(mixed $offset, mixed $value)

Set value to property

void
offsetUnset(mixed $offset)

Unset a property.

getIterator()

Get the data store for iterate.

string
serialize()

Serialize data.

unserialize(string $serialized)

Unserialize the data.

int
count()

Count data.

mixed
jsonSerialize()

Serialize to json format.

boolean
isNull()

Is this data set empty?

boolean
notNull()

Is this data set has properties?

Data[]
dump(bool $recursive = false)

Dump all data as array.

static array
allToArray(mixed $value)

allToArray

map(callable $callback)

Mapping all elements.

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

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

ksort(integer $flags = null)

Sort Dataset by key.

krsort(integer $flags = null)

Sort DataSet by key in reverse order

sort(integer $flags = null)

Sort data.

rsort(integer $flags = null)

Sort Data in reverse order.

uksort(callable $callable)

Sort DataSet by keys using a user-defined comparison function

shuffle()

Shuffle this DataSet to random orders.

first()

Get first element.

last()

Get last element.

push(Data|mixed $data)

Push element to last.

pop()

Pop the last element.

shift()

Shift the first element.

unshift(Data|mixed $data)

Unshift the first element.

void
__clone()

Clone this class.

array
getKeys()

Return all the keys of this DataSet.

Details

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

Constructor.

Parameters

mixed $data

at line line 51
Data bind(array $dataset)

Bind data array into self.

Parameters

array $dataset The data array or object.

Return Value

Data Return self to support chaining.

Exceptions

InvalidArgumentException

at line line 88
array __get(string $property)

The magic get method is used to get a list of properties from the objects in the data set.

Example: $array = $dataSet->foo;

This will return a column of the values of the 'foo' property in all the objects (or values determined by custom property setters in the individual Data's). The result array will contain an entry for each object in the list (compared to __call which may not). The keys of the objects and the result array are maintained.

Parameters

string $property The name of the data property.

Return Value

array An associative array of the values.

at line line 111
boolean __isset(string $property)

The magic isset method is used to check the state of an object property using the iterator.

Example: $array = isset($objectList->foo);

Parameters

string $property The name of the property.

Return Value

boolean True if the property is set in any of the objects in the data set.

at line line 138
void __set(string $property, mixed $value)

The magic set method is used to set an object property using the iterator.

Example: $objectList->foo = 'bar';

This will set the 'foo' property to 'bar' in all of the objects (or a value determined by custom property setters in the Data).

Parameters

string $property The name of the property.
mixed $value The value to give the data property.

Return Value

void

at line line 159
void __unset(string $property)

The magic unset method is used to unset an object property using the iterator.

Example: unset($objectList->foo);

This will unset all of the 'foo' properties in the list of Data\Object's.

Parameters

string $property The name of the property.

Return Value

void

at line line 175
boolean offsetExists(mixed $offset)

Property is exist or not.

Parameters

mixed $offset Property key.

Return Value

boolean

at line line 187
mixed offsetGet(mixed $offset)

Get a value of property.

Parameters

mixed $offset Property key.

Return Value

mixed The value of this property.

at line line 202
DataSet clear()

Clears the objects in the data set.

Return Value

DataSet Returns itself to allow chaining.

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

Set value to property

Parameters

mixed $offset Property key.
mixed $value Property value to set.

Return Value

void

at line line 241
void offsetUnset(mixed $offset)

Unset a property.

Parameters

mixed $offset Key to unset.

Return Value

void

at line line 251
Traversable getIterator()

Get the data store for iterate.

Return Value

Traversable The data to be iterator.

at line line 261
string serialize()

Serialize data.

Return Value

string Serialized data string.

at line line 273
DataSet unserialize(string $serialized)

Unserialize the data.

Parameters

string $serialized THe serialized data string.

Return Value

DataSet Support chaining.

at line line 285
int count()

Count data.

Return Value

int

at line line 295
mixed jsonSerialize()

Serialize to json format.

Return Value

mixed

at line line 305
boolean isNull()

Is this data set empty?

Return Value

boolean True if empty.

at line line 315
boolean notNull()

Is this data set has properties?

Return Value

boolean True is exists.

at line line 327
Data[] dump(bool $recursive = false)

Dump all data as array.

Parameters

bool $recursive

Return Value

Data[]

at line line 346
static array allToArray(mixed $value)

allToArray

Parameters

mixed $value

Return Value

array

at line line 385
DataSet map(callable $callback)

Mapping all elements.

Parameters

callable $callback

Return Value

DataSet Support chaining.

at line line 402
DataSet 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

DataSet Support chaining.

at line line 418
DataSet ksort(integer $flags = null)

Sort Dataset by key.

Parameters

integer $flags You may modify the behavior of the sort using the optional parameter flags.

Return Value

DataSet Support chaining.

at line line 434
DataSet krsort(integer $flags = null)

Sort DataSet by key in reverse order

Parameters

integer $flags You may modify the behavior of the sort using the optional parameter flags.

Return Value

DataSet Support chaining.

at line line 450
DataSet sort(integer $flags = null)

Sort data.

Parameters

integer $flags You may modify the behavior of the sort using the optional parameter flags.

Return Value

DataSet Support chaining.

at line line 466
DataSet rsort(integer $flags = null)

Sort Data in reverse order.

Parameters

integer $flags You may modify the behavior of the sort using the optional parameter flags.

Return Value

DataSet Support chaining.

at line line 482
DataSet uksort(callable $callable)

Sort DataSet by keys using a user-defined comparison function

Parameters

callable $callable The compare function used for the sort.

Return Value

DataSet Support chaining.

at line line 496
DataSet shuffle()

Shuffle this DataSet to random orders.

Return Value

DataSet Support chaining.

at line line 508
Data first()

Get first element.

Return Value

Data

at line line 518
Data last()

Get last element.

Return Value

Data

at line line 530
DataSet push(Data|mixed $data)

Push element to last.

Parameters

Data|mixed $data Data to push.

Return Value

DataSet

at line line 542
Data pop()

Pop the last element.

Return Value

Data

at line line 554
Data shift()

Shift the first element.

Return Value

Data @since 3.0

at line line 568
DataSet unshift(Data|mixed $data)

Unshift the first element.

Parameters

Data|mixed $data Data to push.

Return Value

DataSet @since 3.0

at line line 582
void __clone()

Clone this class.

Return Value

void

at line line 608
array getKeys()

Return all the keys of this DataSet.

Return Value

array