src/Components/Schema.php
public function typecastToClient($value, $field_info, $allow_null = true)
    {
        if (is_null($value) && $allow_null) {
            return null;
        }

        $type = DbSimpleTypes::TYPE_STRING;
        if (is_string($field_info)) {
            $type = $field_info;
        } elseif ($field_info instanceof ColumnSchema) {
            $type = $field_info->type;
        } elseif ($field_info instanceof ParameterSchema) {
            $type = $field_info->type;
        }

        $type = strtolower(strval($type));
        switch ($type) {
            // special handling for datetime types
            case DbSimpleTypes::TYPE_DATE:
            case DbSimpleTypes::TYPE_DATETIME:
            case DbSimpleTypes::TYPE_DATETIME_TZ:
            case DbSimpleTypes::TYPE_TIME:
            case DbSimpleTypes::TYPE_TIME_TZ:
            case DbSimpleTypes::TYPE_TIMESTAMP:
            case DbSimpleTypes::TYPE_TIMESTAMP_TZ:
            case DbSimpleTypes::TYPE_TIMESTAMP_ON_CREATE:
            case DbSimpleTypes::TYPE_TIMESTAMP_ON_UPDATE:
                return static::formatDateTime(
                    $this->getConfigDateTimeFormat($type),
                    $this->getNativeDateTimeFormat($field_info),
                    $value
                );
        }

        return $this->formatValueToPhpType($value, $this->extractPhpType($type));
    }
public function typecastToClient($value, $field_info, $allow_null = true)
    {
        if (is_null($value) && $allow_null) {
            return null;
        }

        $type = DbSimpleTypes::TYPE_STRING;
        if (is_string($field_info)) {
            $type = $field_info;
        } elseif ($field_info instanceof ColumnSchema) {
            $type = $field_info->type;
        } elseif ($field_info instanceof ParameterSchema) {
            $type = $field_info->type;
        }

        $type = strtolower(strval($type));
        switch ($type) {
            // special handling for datetime types
            case DbSimpleTypes::TYPE_DATE:
            case DbSimpleTypes::TYPE_DATETIME:
            case DbSimpleTypes::TYPE_DATETIME_TZ:
            case DbSimpleTypes::TYPE_TIME:
            case DbSimpleTypes::TYPE_TIME_TZ:
            case DbSimpleTypes::TYPE_TIMESTAMP:
            case DbSimpleTypes::TYPE_TIMESTAMP_TZ:
            case DbSimpleTypes::TYPE_TIMESTAMP_ON_CREATE:
            case DbSimpleTypes::TYPE_TIMESTAMP_ON_UPDATE:
                return static::formatDateTime(
                    $this->getConfigDateTimeFormat($type),
                    $this->getNativeDateTimeFormat($field_info),
                    $value
                );
        }

        return $this->formatValueToPhpType($value, $this->extractPhpType($type));
    }
@param mixed                               $value
@param string|ParameterSchema|ColumnSchema $field_info
@param boolean                             $allow_null

@return mixed