StructureHelper
class StructureHelper (View source)
Class StructureHelper
Methods
Load the contents of a file into the structure
Load a string into the structure
Get a namespace in a given string format
getFormatClass
Method to determine if an array is an associative array.
getValue
Utility function to map an array to a stdClass object.
Get data from array or object by path.
setByPath
Explode the structure path into an array and remove empty nodes that occur as a result of a double dot. ex: windwalker.
Method to recursively convert data to one dimension array.
Utility function to convert all types to an array.
dumpObjectValues
Details
at line line 36
static array
loadFile(string $file, string $format = Format::JSON, array $options = array())
Load the contents of a file into the structure
at line line 66
static array
loadString(string $data, string $format = Format::JSON, array $options = array())
Load a string into the structure
at line line 85
static string
toString(array|object $data, string $format = Format::JSON, mixed $options = array())
Get a namespace in a given string format
at line line 103
static string|FormatInterface
getFormatClass(string $format)
getFormatClass
at line line 123
static boolean
isAssociativeArray(array $array)
Method to determine if an array is an associative array.
at line line 148
static mixed
getValue(array $array, string $name, mixed $default = null)
getValue
at line line 163
static object
toObject(array $array, string $class = 'stdClass')
Utility function to map an array to a stdClass object.
at line line 195
static mixed
getByPath(array $data, mixed $path, string $separator = '.')
Get data from array or object by path.
Example: StructureHelper::getByPath($array, 'foo.bar.yoo')
equals to $array['foo']['bar']['yoo'].
at line line 241
static boolean
setByPath(array $data, string $path, mixed $value, string $separator = '.')
setByPath
at line line 287
static array
getPathNodes(string $path, string $separator = '.')
Explode the structure path into an array and remove empty nodes that occur as a result of a double dot. ex: windwalker.
.test Finally, re-key the array so they are sequential.
at line line 301
static array
flatten(array|object $array, string $separator = '.', string $prefix = '')
Method to recursively convert data to one dimension array.
at line line 339
static array
toArray(mixed $data, bool $recursive = false)
Utility function to convert all types to an array.
at line line 376
static array
dumpObjectValues(mixed $object)
dumpObjectValues