Class CFTypeDetector

Description

CFTypeDetector Interface for converting native PHP data structures to CFPropertyList objects.

Located in /CFTypeDetector.php (line 14)


	
			
Variable Summary
Method Summary
CFTypeDetector __construct ([boolean $autoDicitionary = false], [boolean $suppressExceptions = false])
boolean isAssociativeArray (array $value)
CFType toCFType (mixed $value, boolean $autoDictionary)
Variables
boolean $autoDictionary = false (line 20)

flag stating if all arrays should automatically be converted to CFDictionary

  • access: protected
boolean $suppressExceptions = false (line 26)

flag stating if exceptions should be suppressed or thrown

  • access: protected
Methods
Constructor __construct (line 33)

Create new CFTypeDetector

  • access: public
CFTypeDetector __construct ([boolean $autoDicitionary = false], [boolean $suppressExceptions = false])
  • boolean $autoDicitionary: if set to true all arrays will be converted to CFDictionary
  • boolean $suppressExceptions: if set to true toCFType() will not throw any exceptions
defaultValue (line 62)

Get the default value

  • return: the default value to return if no suitable type could be determined
  • access: protected
CFType defaultValue ()
isAssociativeArray (line 44)

Determine if an array is associative or numerical.

Numerical Arrays have incrementing index-numbers that don't contain gaps.

  • return: true if array is associative, false if array has numeric indexes
  • access: protected
  • usedby: CFTypeDetector::toCFType() - to check if an array only has numeric indexes
boolean isAssociativeArray (array $value)
  • array $value: Array to check indexes of
toCFType (line 84)

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.

CFType toCFType (mixed $value, boolean $autoDictionary)
  • mixed $value: Value to convert to CFType
  • boolean $autoDictionary: if true CFArray-detection is bypassed and arrays will be returned as CFDictionary.

Documentation generated on Fri, 01 Jan 2010 21:33:34 +0100 by phpDocumentor 1.4.1