public function value($value, array $schema = array())
{
$schema += array('default' => null, 'null' => false);
if (is_array($value)) {
foreach ($value as $key => $val) {
$value[$key] = $this->value($val, isset($schema[$key]) ? $schema[$key] : $schema);
}
return $value;
}
if (is_object($value) && isset($value->scalar)) {
return $value->scalar;
}
$type = isset($schema['type']) ? $schema['type'] : $this->_introspectType($value);
$column = isset($this->_columns[$type]) ? $this->_columns[$type] : null;
return $this->_cast($type, $value, $column, $schema);
}