Structure
class Structure implements JsonSerializable, ArrayAccess, IteratorAggregate, Countable (View source)
Structure class
Methods
Constructor
Magic function to render this object as a string using default args of toString method.
Implementation for the JsonSerializable interface.
Check if a structure path exists.
Get a structure value.
Load an array or object of values into the default namespace
Load the contents of a file into the structure
Load a string into the structure
Checks whether an offset exists in the iterator.
Gets an offset in the iterator.
Sets an offset in the iterator.
Unsets an offset in the iterator.
Transforms a namespace to an array
Transforms a namespace to an object
Get a namespace in a given string format
Dump to on dimension array.
Method to get property Separator
Method to set property separator
Push value to a path in structure
Prepend value to a path in structure.
To remove first element from the path of this structure.
To remove last element from the path of this structure.
Gets this object represented as an RecursiveArrayIterator.
Count elements of the data object
Method to get property IgnoreValues
Method to set property ignoreValues
Details
at line line 53
__construct(mixed $data = null, string $format = Format::JSON)
Constructor
at line line 85
string
__toString()
Magic function to render this object as a string using default args of toString method.
at line line 106
mixed
jsonSerialize()
Implementation for the JsonSerializable interface.
Allows us to pass Structure objects to json_encode.
at line line 121
Structure
def(string $path, mixed $value = '')
Sets a default value if not already assigned.
at line line 138
boolean
exists(string $path)
Check if a structure path exists.
at line line 153
mixed
get(string $path, mixed $default = null)
Get a structure value.
at line line 180
Structure
load(array|object $data, boolean $raw = false)
Load an array or object of values into the default namespace
at line line 198
Structure
loadFile(string $file, string $format = Format::JSON, array $options = array())
Load the contents of a file into the structure
at line line 218
Structure
loadString(string $data, string $format = Format::JSON, array $options = array())
Load a string into the structure
at line line 237
Structure
merge(Structure|mixed $source, boolean $raw = false)
Merge a structure data into this object.
at line line 258
Structure
mergeTo(string $path, Structure $source, boolean $raw = false)
Merge a structure data to a node.
at line line 316
boolean
offsetExists(mixed $offset)
Checks whether an offset exists in the iterator.
at line line 330
mixed
offsetGet(mixed $offset)
Gets an offset in the iterator.
at line line 345
void
offsetSet(mixed $offset, mixed $value)
Sets an offset in the iterator.
at line line 359
void
offsetUnset(mixed $offset)
Unsets an offset in the iterator.
at line line 374
Structure
set(string $path, mixed $value)
Set a structure value and convert object to array.
at line line 410
array
toArray()
Transforms a namespace to an array
at line line 424
object
toObject(string $class = 'stdClass')
Transforms a namespace to an object
at line line 439
string
toString(string $format = Format::JSON, mixed $options = array())
Get a namespace in a given string format
at line line 524
string[]
flatten(string $separator = '.')
Dump to on dimension array.
at line line 536
string
getSeparator()
Method to get property Separator
at line line 567
integer
push(string $path, mixed $value)
Push value to a path in structure
at line line 613
integer
unshift(string $path, mixed $value)
Prepend value to a path in structure.
at line line 656
mixed
shift(string $path)
To remove first element from the path of this structure.
at line line 684
mixed
pop(string $path)
To remove last element from the path of this structure.
at line line 718
RecursiveArrayIterator
getIterator()
Gets this object represented as an RecursiveArrayIterator.
This allows the data properties to be accessed via a foreach statement.
You can wrap this iterator by RecursiveIteratorIterator that will support recursive foreach.
Example: foreach (new \RecursiveIteratorIterator($structure) as $value)
at line line 731
integer
count()
Count elements of the data object
at line line 741
array
getIgnoreValues()
Method to get property IgnoreValues