See Release Notes
Long Term Support Release
Differences Between: [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]
CFTypeDetector Interface for converting native PHP data structures to CFPropertyList objects.
Author: | Rodney Rehm <rodney.rehm@medialize.de> |
Author: | Christian Kruse <cjk@wwwtech.de> |
File Size: | 185 lines (6 kb) |
Included or required: | 1 time |
Referenced: | 0 times |
Includes or requires: | 0 files |
CFTypeDetector:: (4 methods):
__construct()
isAssociativeArray()
defaultValue()
toCFType()
Class: CFTypeDetector - X-Ref
__construct(array $options=array() X-Ref |
Create new CFTypeDetector param: array $options Configuration for casting values [autoDictionary, suppressExceptions, objectToArrayMethod, castNumericStrings] |
isAssociativeArray($value) X-Ref |
Determine if an array is associative or numerical. Numerical Arrays have incrementing index-numbers that don't contain gaps. param: array $value Array to check indexes of return: boolean true if array is associative, false if array has numeric indexes |
defaultValue() X-Ref |
Get the default value return: CFType the default value to return if no suitable type could be determined |
toCFType($value) X-Ref |
Create CFType-structure by guessing the data-types. {@link CFArray}, {@link CFDictionary}, {@link CFBoolean}, {@link CFNumber} and {@link CFString} can be created, {@link CFDate} and {@link CFData} cannot. <br /><b>Note:</b>Distinguishing between {@link CFArray} and {@link CFDictionary} is done by examining the keys. Keys must be strictly incrementing integers to evaluate to a {@link 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 {@link CFDictionary}, feel free to set the appropriate flag. <br /><b>Note:</b> If $value is an instance of CFType it is simply returned. <br /><b>Note:</b> If $value is neither a CFType, array, numeric, boolean nor string, it is omitted. param: mixed $value Value to convert to CFType param: boolean $autoDictionary if true {@link CFArray}-detection is bypassed and arrays will be returned as {@link CFDictionary}. return: CFType CFType based on guessed type |