\AlibabaCloud\Client\TraitsHasDataTrait

Trait HasDataTrait

Summary

Methods
Properties
Constants
search()
clear()
flatten()
get()
set()
isEmpty()
setReference()
toJson()
toArray()
offsetExists()
offsetGet()
offsetSet()
offsetUnset()
delete()
count()
getIterator()
jsonSerialize()
__get()
all()
__set()
add()
__isset()
has()
__unset()
No public properties found
No constants found
dot()
$dot
N/A
No private methods found
No private properties found
N/A

Properties

$dot

$dot : \Adbar\Dot

Instance of the Dot.

Type

\Adbar\Dot

Methods

search()

search(string  $expression) : mixed|null

Parameters

string $expression

Returns

mixed|null

clear()

clear(array|integer|string|null  $keys = null) 

Delete the contents of a given key or keys

Parameters

array|integer|string|null $keys

flatten()

flatten(string  $delimiter = '.', array|null  $items = null, string  $prepend = '') : array

Flatten an array with the given character as a key delimiter

Parameters

string $delimiter
array|null $items
string $prepend

Returns

array

get()

get(integer|string|null  $key = null, mixed  $default = null) : mixed

Return the value of a given key

Parameters

integer|string|null $key
mixed $default

Returns

mixed

set()

set(array|integer|string  $keys, mixed  $value = null) 

Set a given key / value pair or pairs

Parameters

array|integer|string $keys
mixed $value

isEmpty()

isEmpty(array|integer|string|null  $keys = null) : boolean

Check if a given key or keys are empty

Parameters

array|integer|string|null $keys

Returns

boolean

setReference()

setReference(array  $items) 

Replace all items with a given array as a reference

Parameters

array $items

toJson()

toJson(mixed  $key = null, integer  $options) : string

Return the value of a given key or all the values as JSON

Parameters

mixed $key
integer $options

Returns

string

toArray()

toArray() : array

Returns

array

offsetExists()

offsetExists(integer|string  $key) : boolean

Check if a given key exists

Parameters

integer|string $key

Returns

boolean

offsetGet()

offsetGet(integer|string  $key) : mixed

Return the value of a given key

Parameters

integer|string $key

Returns

mixed

offsetSet()

offsetSet(integer|string|null  $key, mixed  $value) 

Set a given value to the given key

Parameters

integer|string|null $key
mixed $value

offsetUnset()

offsetUnset(integer|string  $key) 

Delete the given key

Parameters

integer|string $key

delete()

delete(array|integer|string  $keys) 

Delete the given key or keys

Parameters

array|integer|string $keys

count()

count(integer|string|null  $key = null) : integer

Return the number of items in a given key

Parameters

integer|string|null $key

Returns

integer

getIterator()

getIterator() : \ArrayIterator

Get an iterator for the stored items

Returns

\ArrayIterator

jsonSerialize()

jsonSerialize() : array

Return items for JSON serialization

Returns

array

__get()

__get(string  $name) : mixed|null

Parameters

string $name

Returns

mixed|null

all()

all() : array

Return all the stored items

Returns

array

__set()

__set(string  $name, mixed  $value) 

Parameters

string $name
mixed $value

add()

add(array|integer|string  $keys, mixed  $value = null) 

Set a given key / value pair or pairs if the key doesn't exist already

Parameters

array|integer|string $keys
mixed $value

__isset()

__isset(string  $name) : boolean

Parameters

string $name

Returns

boolean

has()

has(array|integer|string  $keys) : boolean

Check if a given key or keys exists

Parameters

array|integer|string $keys

Returns

boolean

__unset()

__unset(  $name) : void

Parameters

$name

dot()

dot(array  $data = array()) 

Parameters

array $data