Data Class.
More...
|
static | load ($fileName, $stripXmlAttributes=true) |
|
static | set (&$destination, $source, $strict=false, $merge=false) |
|
static | setObject (&$destination, $source, $strict=true, $merge=false) |
|
static | setArray (&$destination, $source, $strict=false) |
|
Data Class.
Class to work with different data formats
- Version
- 3.0
- Author
- Digger mrdig.nosp@m.ger@.nosp@m.sad-s.nosp@m.yste.nosp@m.ms.ru
- Copyright
- (c) 2015, SAD-Systems
static load |
( |
|
$fileName, |
|
|
|
$stripXmlAttributes = true |
|
) |
| |
|
static |
Loads a data from file and returns data as a hash array.
The file can be in the following formats:
- Parameters
-
string | Array | $fileName | The name of config file. May be specified as a string or an array of strings (list of possible alternative file names).
For example: array("config.php", "config.json", "config.xml") |
boolean | $stripXmlAttributes |
- =TRUE, XML-tag's attributes will be ignored (except "value" attribute, its value will be saved as tag's value).
- =FALSE, XML-tag's attributes will be stored as @attributes.
|
- Returns
- hash Array or FALSE, if file $fileName not found.
static set |
( |
& |
$destination, |
|
|
|
$source, |
|
|
|
$strict = false , |
|
|
|
$merge = false |
|
) |
| |
|
static |
Set data from hash array (or config file) to a destination object or an array
- Parameters
-
object | $destination | Link to destination class or an array to be set. |
string | hash | $source | "Config file name" or hash array of property values to set to destination. |
boolean | $strict | =TRUE - non-existent properties will be ignored;
=FALSE - non-existent properties will be created and set. |
boolean | $merge | =TRUE - if class property is an array new and old values will be merged (recursively). |
- Returns
- boolean TRUE if properties of class was successfully set.
static setArray |
( |
& |
$destination, |
|
|
|
$source, |
|
|
|
$strict = false |
|
) |
| |
|
static |
Copy data from source array to destination array
- Parameters
-
array | $destination | Destination array |
array | $source | Source array |
boolean | $strict | If =TRUE the source key mast exists in desstination array or be a number |
static setObject |
( |
& |
$destination, |
|
|
|
$source, |
|
|
|
$strict = true , |
|
|
|
$merge = false |
|
) |
| |
|
static |
Copy data from source array to destination Object
- Parameters
-
array | $destination | Destination array |
array | $source | Source array |
boolean | $strict | =TRUE - non-existent properties will be ignored;
=FALSE - non-existent properties will be created and set. |
boolean | $merge | =TRUE - if class property is an array new and old values will be merged (recursively) |
The documentation for this class was generated from the following file: