Config
extends ArrayObject
in package
Config class
Tags
Table of Contents
- $allowChanges : bool
- Flag for whether or not changes are allowed after object instantiation
- $data : array<string|int, mixed>
- Array data
- __construct() : mixed
- Constructor
- __get() : mixed
- Get a value
- __isset() : bool
- Is value set
- __set() : void
- Set a value
- __unset() : void
- Unset a value
- changesAllowed() : bool
- Return if changes to the config are allowed.
- count() : int
- Method to get the count of the array object
- createFromData() : self
- Method to create a config object from parsed data
- createFromJson() : ArrayObject
- Create array object from JSON string
- createFromSerialized() : ArrayObject
- Create array object from serialized string
- getIterator() : ArrayIterator
- Method to iterate over the array object
- jsonSerialize() : string
- JSON serialize the array object
- jsonUnserialize() : ArrayObject
- Unserialize a JSON string
- merge() : Config
- Merge the values of another config object into this one.
- mergeFromData() : Config
- Merge the values of another config object into this one.
- offsetExists() : bool
- ArrayAccess offsetExists
- offsetGet() : mixed
- ArrayAccess offsetGet
- offsetSet() : void
- ArrayAccess offsetSet
- offsetUnset() : void
- ArrayAccess offsetUnset
- parseData() : array<string|int, mixed>
- Method to parse data and return config values
- serialize() : string
- Serialize the array object
- toArray() : array<string|int, mixed>
- Get the values as an array
- toArrayObject() : ArrayObject
- Get the config values as an array
- toIni() : string
- Get the config values as an INI string
- toJson() : string
- Get the config values as a JSON string
- toXml() : string
- Get the config values as an XML string
- unserialize() : ArrayObject
- Unserialize a string
- writeToFile() : void
- Write the config data to file
- arrayToIni() : string
- Method to convert array to INI
- arrayToXml() : void
- Method to convert array to XML
Properties
$allowChanges
Flag for whether or not changes are allowed after object instantiation
protected
bool
$allowChanges
= false
$data
Array data
protected
array<string|int, mixed>
$data
= []
Methods
__construct()
Constructor
public
__construct([mixed $data = [] ][, bool $changes = false ]) : mixed
Instantiate a config object
Parameters
- $data : mixed = []
- $changes : bool = false
Return values
mixed —__get()
Get a value
public
__get(string $name) : mixed
Parameters
- $name : string
Return values
mixed —__isset()
Is value set
public
__isset(string $name) : bool
Parameters
- $name : string
Return values
bool —__set()
Set a value
public
__set(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
Tags
Return values
void —__unset()
Unset a value
public
__unset(string $name) : void
Parameters
- $name : string
Tags
Return values
void —changesAllowed()
Return if changes to the config are allowed.
public
changesAllowed() : bool
Return values
bool —count()
Method to get the count of the array object
public
count() : int
Return values
int —createFromData()
Method to create a config object from parsed data
public
static createFromData(mixed $data[, bool $changes = false ]) : self
Parameters
- $data : mixed
- $changes : bool = false
Return values
self —createFromJson()
Create array object from JSON string
public
static createFromJson(string $jsonString[, int $depth = 512 ], int $options) : ArrayObject
Parameters
- $jsonString : string
- $depth : int = 512
- $options : int
Return values
ArrayObject —createFromSerialized()
Create array object from serialized string
public
static createFromSerialized(string $string) : ArrayObject
Parameters
- $string : string
Return values
ArrayObject —getIterator()
Method to iterate over the array object
public
getIterator() : ArrayIterator
Return values
ArrayIterator —jsonSerialize()
JSON serialize the array object
public
jsonSerialize(int $options[, int $depth = 512 ]) : string
Parameters
- $options : int
- $depth : int = 512
Return values
string —jsonUnserialize()
Unserialize a JSON string
public
jsonUnserialize(string $jsonString[, int $depth = 512 ], int $options) : ArrayObject
Parameters
- $jsonString : string
- $depth : int = 512
- $options : int
Return values
ArrayObject —merge()
Merge the values of another config object into this one.
public
merge(mixed $data[, bool $preserve = false ]) : Config
By default, existing values are overwritten, unless the $preserve flag is set to true.
Parameters
- $data : mixed
- $preserve : bool = false
Tags
Return values
Config —mergeFromData()
Merge the values of another config object into this one.
public
mergeFromData(mixed $data[, bool $preserve = false ]) : Config
By default, existing values are overwritten, unless the $preserve flag is set to true.
Parameters
- $data : mixed
- $preserve : bool = false
Tags
Return values
Config —offsetExists()
ArrayAccess offsetExists
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Return values
bool —offsetGet()
ArrayAccess offsetGet
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
Return values
mixed —offsetSet()
ArrayAccess offsetSet
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
Return values
void —offsetUnset()
ArrayAccess offsetUnset
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
Return values
void —parseData()
Method to parse data and return config values
public
static parseData(mixed $data) : array<string|int, mixed>
Parameters
- $data : mixed
Return values
array<string|int, mixed> —serialize()
Serialize the array object
public
serialize([bool $self = false ]) : string
Parameters
- $self : bool = false
Return values
string —toArray()
Get the values as an array
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —toArrayObject()
Get the config values as an array
public
toArrayObject() : ArrayObject
Return values
ArrayObject —toIni()
Get the config values as an INI string
public
toIni() : string
Return values
string —toJson()
Get the config values as a JSON string
public
toJson() : string
Return values
string —toXml()
Get the config values as an XML string
public
toXml() : string
Return values
string —unserialize()
Unserialize a string
public
unserialize(string $string) : ArrayObject
Parameters
- $string : string
Tags
Return values
ArrayObject —writeToFile()
Write the config data to file
public
writeToFile(string $filename) : void
Parameters
- $filename : string
Tags
Return values
void —arrayToIni()
Method to convert array to INI
protected
arrayToIni(array<string|int, mixed> $array) : string
Parameters
- $array : array<string|int, mixed>
Return values
string —arrayToXml()
Method to convert array to XML
protected
arrayToXml(array<string|int, mixed> $array, SimpleXMLElement &$config) : void
Parameters
- $array : array<string|int, mixed>
- $config : SimpleXMLElement