function addObjectOnly(&$value) { $name = get_qualified_type($value); $this->addObject($name, &$value); }
function is_assignable($type, $value) { if (is_null($value)) { return true; } assert_not_null($type, 'Function is_assignable: $type must not be null'); if (!is_string($type)) { show_error('is_assignable', '$type must be a string'); } if (is_array_type($type)) { // $array_type = get_array_component_type($type); return get_qualified_type($value) == $type; } switch (strtolower($type)) { case 'string': if (is_string($value)) { return true; } break; case 'int': if (is_int($value)) { return true; } break; case 'boolean': if (is_bool($value)) { return true; } break; case 'array': if (is_array($value)) { return true; } break; case 'float': if (is_float($value)) { return true; } break; default: if (is_object($value) && is_subclass(get_class($value), $type)) { return true; } break; } return false; }
function &_convertToArray($input, $propertyName, $componentType) { if (is_array($input)) { // Convert array elements, if necessary. if ($componentType == get_array_component_type(get_qualified_type($input)) && !$this->hasCustomEditorForElement($componentType, $propertyName)) { return $input; } $result = array(); foreach ($input as $key => $arrayValue) { $value =& $this->convertIfNecessary($this->_buildIndexedPropertyName($propertyName, $key), _null(), $arrayValue, $componentType, _null()); //if($value == null) return _null(); $result[$key] = $value; } return $result; } else { // A plain value: convert it to an array with a single component. $result = array(); $value =& $this->convertIfNecessary($this->_buildIndexedPropertyName($propertyName, 0), _null(), $input, $componentType, _null()); if ($value == null) { return _null(); } $result[] = $value; return $result; } }