/** Return the property options for the object
* If an options method exists, answer the method result.
* otherwise delegate to the types ClassDescriptor
* If the type is a class name and the class has a method 'getInstances'
* assume it is a static method, call it and return the result.
* @throws PntReflectionError if ClassDescriptor returns null, or type is not a class
* @param PntObject the object to get the options for
* @param PntSqlFilter $filter ignoored
* @return Array the options
*/
function ($obj, $filter=true) {
$name = $this->();
$mth = "get$name".'Options';
if (method_exists($obj, $mth))
return $obj->$mth($filter); //use getter method if there
$className = $this->();
if ($className == 'boolean')
return array(true, false);
if (!class_exists($className))
Gen::tryIncludeClass($className, $this->()); //parameters from own properties
if (!class_exists($className))
throw new PntReflectionError(
$this. ' no options getter, and type is not a class'
);
$clsDesc = PntClassDescriptor::getInstance($className);
try {
return $clsDesc->();
} catch (PntError $err) {
throw new PntReflectionError(
"$this can not get options: no getter or"
, 0, $err);
}
}
|