分解一个没有键的数组元素
@param $value string 字符串
@return array [sortBy,direction]
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;
    }
286827
public static function parse($value)
    {
        if (\is_string($value)) {
            $operator = null;
            if (\strpos($value, AbstractMatcher::OPERATOR_AND)) {
                $operator = AbstractMatcher::OPERATOR_AND;
                $value = \explode(AbstractMatcher::OPERATOR_AND, $value);
            } elseif (\strpos($value, AbstractMatcher::OPERATOR_OR)) {
                $operator = AbstractMatcher::OPERATOR_OR;
                $value = \explode(AbstractMatcher::OPERATOR_OR, $value);
            } elseif (0 === \strpos($value, AbstractMatcher::OPERATOR_NOT)) {
                $value = [AbstractMatcher::OPERATOR_NOT => \substr($value, 1)];
            }
            if (null !== $operator) {
                return [
                    $operator => \array_map(
                        function ($val) {
                            return 0 === \strpos($val, AbstractMatcher::OPERATOR_NOT)
                                ? [AbstractMatcher::OPERATOR_NOT => \substr($val, 1)]
                                : $val;
                        },
                        $value
                    )
                ];
            }
        }

        return $value;
    }
1104365
public function filter($value)
    {
        if (null === $value) {
            return null;
        }
        $this->checkValueIsArrayOrThrowException($value);

        $return = [];
        foreach ($value as $header => $condition) {
            $return[$header] = $this->conditionFilter->filter($condition);
        }

        return $return;
    }
1153954
public static function convertToPhp($value)
    {
        if (!is_array($value)) {
            return [];
        }

        // see DateType::convertToPHPValue()
        $convertor = function ($value) {
            try {
                return DateType::getDateTime($value);
            } catch (\InvalidArgumentException $e) {
                return null;
            }
        };

        return array_values(array_filter(array_map($convertor, $value)));
    }
413634
public static function notEmpty($value)
    {
        if (is_object($value) && $value instanceof ArrayObject)
        {
            // 如果是个ArrayObject对象，那么先读取起内容
            $value = $value->getArrayCopy();
        }

        return ! in_array($value, [
            null,
            false,
            '',
            []
        ], true);
    }
344561
private function prepareRow($value)
    {
        if (is_array($value) and count($value) === 1) {
            $value = array_shift($value);
        }

        return $value;
    }
1270449
public function sortedIndex($collection=null, $value=null, $iterator=null) {
    list($collection, $value, $iterator) = self::_wrapArgs(func_get_args(), 3);
    
    $collection = (array) self::_collection($collection);
    $__ = new self;
    
    $calculated_value = (!is_null($iterator)) ? $iterator($value) : $value;
    
    while(count($collection) > 1) {
      $midpoint = floor(count($collection) / 2);
      $midpoint_values = array_slice($collection, $midpoint, 1);
      $midpoint_value = $midpoint_values[0];
      $midpoint_calculated_value = (!is_null($iterator)) ? $iterator($midpoint_value) : $midpoint_value;
      
      $collection = ($calculated_value < $midpoint_calculated_value) ? array_slice($collection, 0, $midpoint, true) : array_slice($collection, $midpoint, null, true);
    }
    $keys = array_keys($collection);
    
    return self::_wrap(current($keys) + 1);
  }
609075
public static function keys($value)
    {

        if (is_array($value)) {
            return array_keys($value);
        }

        if (!is_object($value)) {
            return [];
        }

        if (!$value instanceof Traversable) {
            return array_keys(get_object_vars($value));
        }

        return array_keys(iterator_to_array($value, true));

    }
575733
protected function parseStringsToNativeTypes($value)
    {
        if (is_array($value)) {
            return array_map([$this, 'parseStringsToNativeTypes'], $value);
        }

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

        $parsedValue = json_decode($value, true);

        if (json_last_error() === JSON_ERROR_NONE) {
            return $parsedValue;
        }

        return $value;
    }
19738
private function markIn($value): array
    {
        // 已经是数组,直接返回
        if (is_array($value)) {
            return $value;
        }

        // 除了数组,只能是字符串
        if (!is_string($value)) {
            trigger_error('in运算符的值必须是字符串或数组:' . json($value), E_USER_ERROR);
        }

        // 尝试按逗号分解
        $arr = explode(',', $value);
        if (count($arr) > 1) {
            return $arr;
        }

        // 尝试按空格分解
        $arr = explode(' ', $value);
        if (count($arr) > 1) {
            return $arr;
        }

        // 看来只能是单值了
        return [$value];
    }
1251325
public function filter($value)
    {
        if (!is_string($value)) {
            return $value;
        }
        return $this->allWords ? ucwords(strtolower($value)) : ucfirst(strtolower($value));
    }
431829
public function filter($value)
    {
        if ($value === null) {
            return $value;
        }

        if ($this->characters === null) {
            return trim($value);
        }

        return trim($value, $this->characters);
    }
407307
public function filter($value)
    {
        $chars = ' ';
        if ($this->getExtras()) {
            $chars .= $this->getExtras();
        }
        return trim($value, $chars);
    }
1009832
protected static function getJSONIfArray($value)
    {
        if (is_string($value) && strpos($value, ',') !== false) {
            $value = explode(',', $value);
        }

        if (is_array($value)) {
            foreach ($value as $k => $v) {
                if (is_string($v)) {
                    $value[$k] = trim($v);
                }
            }

            return json_encode($value);
        }

        return $value;
    }
398883
protected function _splitQueryValue($value)
    {
        $data = explode('=', $value, 2);
        if (1 === count($data)) {
            $data[] = null;
        }
        return $data;
    }
1177991
private static function getListFromString($value)
    {
        if (is_string($value_array = $value)) {
            $value = str_replace([',', ' '], ';', $value);
            $value_array = explode(';', $value);
        }

        if (is_array($value_array)) {
            return array_filter(array_map('trim', $value_array));
        }

        return [];
    }
859502
protected function cleanUpValue( $value ) {
		$cleanValue = [];
		if ( !is_array( $value ) ) {
			return $cleanValue;
		}
		foreach ( $value as $singleValue ) {
			$singleValue = parent::cleanUpValue( $singleValue );
			// Remove options that we don't have here
			if ( !isset( $this->fields[ $singleValue ] ) ) {
				continue;
			}
			$cleanValue[] = $singleValue;
		}
		return $cleanValue;
	}