获取序列化后的值
@param $value
@param $event
@return string
345414
protected function getSerializeValue($value, $event)
    {
        switch ($event) {
            case ActiveRecord::EVENT_BEFORE_INSERT:
            case ActiveRecord::EVENT_BEFORE_UPDATE:
                if (is_array($value)) {
                    $value = serialize($value);
                }
                break;
            case ActiveRecord::EVENT_AFTER_FIND:
                $value = @unserialize($value) ?: $value;
                break;
        }
        return $value;
    }
554283
private function formatByMonthGrouping($value)
    {
        $value = $this->getTimestamp($value);
        if ('' === $value) {
            return '-';
        }
        $event = new ParseDateEvent($value, 'F Y');
        $this->dispatcher->dispatch(ContaoEvents::DATE_PARSE, $event);

        return $event->getResult();
    }
1184871
protected function get_value_as_string( $value ) {

		if ( is_object( $value ) && ! in_array( '__toString', get_class_methods( $value ) ) ) {
			$value = get_class( $value ) . ' object';
		} else if ( is_array( $value ) ) {
			$value = var_export( $value, TRUE );
		}

		return (string) $value;
	}
748675
public function setEvents($value)
    {
        if (empty($value)) {
            $value = $this->events_list;
        } elseif (!is_array($value)) {
            $value = [$value];
        }

        $this->values['events'] = $value;

        return $this;
    }
285289
private function encode($value)
    {
        if ($value === true)
            $value = "true";
        else if ($value === false)
            $value = "false";
        else if (is_string($value))
            $value = "\"$value\"";
        return $value;
    }
950538
public function value($value)
    {
        if (is_null($value)) $value = '';
        $this->value = (string)$value;
        return $this;
    }
392525
private function phpEncodeValue($value)
    {
        if (is_array($value)) {
            return $this->phpEncodeArray($value);
        }

        if (is_string($value)) {
            return json_encode($value);
        }

        return var_export($value, true);
    }
85958
static public function editor($value=null)
    {
        if ($value) {
            //$value = DataHelper::filter_xss($value);
            //$value = XssHelper::filter($value); // 对于xss只检测函数，会放过一些不安全语句
        }
        
        // replace 回车13 换行10
        $value = str_replace([chr(13).chr(10), chr(13), chr(10)], '<br>', $value);
        
        return static::_common($value);
    }
1097467
public function getTypeForValue($value) : string
    {
        foreach ($this->handlers as $type => $handler) {
            if ($handler->canHandleValue($value)) {
                return $type;
            }
        }

        throw DataTypeException::handlerNotFoundForValue($value);
    }
322874
private function processValue($value)
    {
        if ($value === "NOW()") {
            return $this->connection()->quote(gmdate("Y-m-d H:i:s"));
        } elseif ($value === "NULL") {
            return 'NULL';
        } elseif (is_array($value)) {
            return $this->connection()->quote(json_encode($value));
        } else {
            return $this->connection()->quote($value);
        }
    }
461696
public static function toString($value)
    {
        if (is_null($value)) {
            $ret = 'null';
        } elseif (is_bool($value)) {
            $ret = $value ? 'true' : 'false';
        } elseif (is_array($value)) {
            $ret = '[' . implode(',', $value) . ']';
        } else if ((!is_object($value) && settype($value, 'string') !== false)
            || (is_object($value) && method_exists($value, '__toString'))
        ) {
            $ret = '' . $value;
        } else {
            $ret = '[no string representation]';
        }

        return $ret;
    }
345162
protected function serializeValue($value)
    {
        $serialized = var_export($value, true);
        if ($serialized === 'NULL') {
            $serialized = strtolower($serialized);
        }

        return $serialized;
    }
170544
private function itemWithoutKey($value): array
    {

        // 如果是数组,按下一级条件拼接条件
        if (is_array($value)) {
            // 递归调用,生成子表达式
            list ($s, $subPrepared, $subParams) = (new self($value, $this->operator == 'AND' ? 'OR' : 'AND'))->result();
            return ['(' . $s . ')', '(' . $subPrepared . ')', $subParams];
        }

        // 必须是字符串了!!!
        if (!is_string($value)) {
            trigger_error('条件必须是数组或字符串:' . json($this->origin) . ':' . json($value),E_USER_ERROR);
        }

        return [$value, $value, []];
    }
469141
public function toString($value)
    {
        switch (gettype($value))
        {
            case 'object':
                return $this->objectToString($value);
            default:
                return var_export($value, true);
        }
    }
352274
private function itemWithoutKey(string $value): array
    {
        $value = $this->formatSort($value);
        $arr = explode(' ', $value);

        // 每一项排序依据最多是二项,(列名+升降)
        if (count($arr) > 2) {
            trigger_error('指定排序的语法错误:' . json($arr), E_USER_ERROR);
        }

        // 只指明了一个值,默认升序
        if (count($arr) == 1) {
            $arr[1] = 'asc';
        }

        // 排序的字段和方向
        return $arr;
    }
480250
public function displayValue($value): string
    {
        if ($value === null) {
            return 'NULL';
        }

        if ($value === true) {
            return 'TRUE';
        }

        if ($value === false) {
            return 'FALSE';
        }

        if (is_array($value)) {
            return Json::encode($value);
        }

        return '"' . str_replace('"', '\"', $value) . '"';
    }
1076537
public static function getFormatValue($value) {

        if ( $value instanceof \MongoId ) return $value;

        $opt = substr($value, 0, 2);
        //1.包含双字符操作符的
        if ( isset(self::$operator[$opt]) ) {
            //获取真正的value
            $_value = substr($value, 2);
            return array(self::$operator[$opt] => $_value);
        }

        //2.包含单字符操作符的
        if ( isset(self::$operator[$value[0]]) ) {
            //获取真正的value
            $_value = substr($value, 1);
            return array(self::$operator[$value[0]] => $_value);
        }

        return $value;
    }