|
boolean | $autoDictionary = false |
| flag stating if all arrays should automatically be converted to CFDictionary
|
|
boolean | $castNumericStrings = true |
| flag stating if "123.23" should be converted to float (true) or preserved as string (false)
|
|
callable | $objectToArrayMethod = null |
| name of a method that will be used for array to object conversations
|
|
boolean | $suppressExceptions = false |
| flag stating if exceptions should be suppressed or thrown
|
|
◆ __construct()
CFTypeDetector::__construct |
( |
array | $options = array() | ) |
|
Create new CFTypeDetector.
- Parameters
-
array | $options | Configuration for casting values [autoDictionary, suppressExceptions, objectToArrayMethod, castNumericStrings] |
◆ defaultValue()
CFTypeDetector::defaultValue |
( |
| ) |
|
|
protected |
Get the default value.
- Return values
-
CFType | the default value to return if no suitable type could be determined |
◆ isAssociativeArray()
CFTypeDetector::isAssociativeArray |
( |
| $value | ) |
|
|
protected |
Determine if an array is associative or numerical.
Numerical Arrays have incrementing index-numbers that don't contain gaps.
- Parameters
-
array | $value | Array to check indexes of |
- Return values
-
boolean | true if array is associative, false if array has numeric indexes |
◆ toCFType()
CFTypeDetector::toCFType |
( |
| $value | ) |
|
Create CFType-structure by guessing the data-types.
CFArray, CFDictionary, CFBoolean, CFNumber and CFString can be created, CFDate and CFData cannot.
Note:Distinguishing between CFArray and CFDictionary is done by examining the keys. Keys must be strictly incrementing integers to evaluate to a CFArray. Since PHP does not offer a function to test for associative arrays, this test causes the input array to be walked twice and thus work rather slow on large collections. If you work with large arrays and can live with all arrays evaluating to CFDictionary, feel free to set the appropriate flag.
Note: If $value is an instance of CFType it is simply returned.
Note: If $value is neither a CFType, array, numeric, boolean nor string, it is omitted.
- Parameters
-
mixed | $value | Value to convert to CFType |
- Return values
-
The documentation for this class was generated from the following file:
- lib/plist/classes/CFPropertyList/CFTypeDetector.php