过滤本数组
@param string|array $keys    需要取得/排除的键
@param bool         $exclude true则排除设置的键名 false则仅获取设置的键名
@return SplArray
170742
public function filter($keys, $exclude = false): SplArray
    {
        if (is_string($keys)) {
            $keys = explode(',', $keys);
        }
        $new = array();
        foreach ($this->getArrayCopy() as $name => $value) {
            if (!$exclude) {
                in_array($name, $keys) ? $new[$name] = $value : null;
            } else {
                in_array($name, $keys) ? null : $new[$name] = $value;
            }
        }
        return new SplArray($new);
    }
342385
public function never(array $keys) : Assoc
    {
        return $this->pipe(function (array $values) use ($keys) : Result {
            $result = Result::success();

            foreach ($keys as $key) {
                if (!isset($values[$key])) {
                    continue;
                }

                $result = $result->concat(
                    Result::failure("contains '$key'")
                );
            }

            return $result;
        });
    }
13015
static public function except(array $input, $keys)
    {
        $keys = is_array($keys) ? $keys : array_slice(func_get_args(),1);

        foreach ($keys as $key) {
            unset($input[$key]);
        }

        return $input;
    }
969138
public static function except(array $input, $excluded = [])
    {
        Arguments::define(Boa::arrOf(Boa::either(
            Boa::string(),
            Boa::integer()
        )))->check($excluded);

        return Std::filter(function ($_, $key) use ($excluded) {
            return !in_array($key, $excluded);
        },
            $input);
    }
1346886
public function only($keys)
    {
        if (is_null($keys)) {
            return new static($this->items);
        }

        $dictionary = Arr::only($this->getDictionary(), $keys);

        return new static(array_values($dictionary));
    }
422078
public function filterByPrimaryKeys($keys)
    {
        if (empty($keys)) {
            return $this->add(null, '1<>1', Criteria::CUSTOM);
        }
        foreach ($keys as $key) {
            $cton0 = $this->getNewCriterion(SkillVersionTableMap::COL_ID, $key[0], Criteria::EQUAL);
            $cton1 = $this->getNewCriterion(SkillVersionTableMap::COL_VERSION, $key[1], Criteria::EQUAL);
            $cton0->addAnd($cton1);
            $this->addOr($cton0);
        }

        return $this;
    }
245543
public function excluding($excludes)
	{
		if($excludes === true)
		{
			$this->model->setIncludes([]);
		}
		else
		{
			$excludes = (array) $excludes;

			$includes = $this->model->getIncludes();

			foreach($excludes as $key => $relation)
			{
				if(is_string($relation) && isset($includes[$relation]))
				{
					unset($includes[$relation], $excludes[$key]); // Unset relations that may have been set with a criterion closure
				}
			}

			$this->model->setIncludes(array_udiff($includes, $excludes, function($a, $b)
			{
				return $a === $b ? 0 : -1;
			}));
		}

		return $this;
	}
594847
public static function select($arr, $includedKeys)
    {
        $ret = [];
        foreach ($includedKeys as $key) {
            if (array_key_exists($key, $arr)) {
                $ret[$key] = $arr[$key];
            }
        }
        return $ret;
    }
715256
public function hasAny($keys = [])
    {
        if ($this->isEmpty()) {
            return false;
        }

        $keys = is_array($keys) ? $keys : func_get_args();

        foreach ($keys as $key) {
            if ($this->has($key)) {
                return true;
            }
        }

        return false;
    }
735908
public static function without(array $array, $remove, $preserveKeys = false): array
    {
        $remove = !is_array($remove) ? [$remove] : $remove;
        $result = [];
        foreach ($array as $key => $value) {
            if (in_array($value, $remove)) {
                continue;
            }

            if ($preserveKeys) {
                $result[$key] = $value;
            } else {
                $result[] = $value;
            }
        }

        return $result;
    }
1011883
public function setExcludes(array $excludes): self
    {
        $this->excludes = \array_map(function ($value) {
            return \trim($value, '/');
        }, $excludes);

        return $this;
    }
1296840
protected function prepareArray(array $collection, array $exclude)
  {
    foreach ($collection as $key => $value)
    {
      if ($this->exclude($key, $exclude) === false)
      {
        $collection[$key] = $this->prepareArrayValue($value, $this->excludeNext($key, $exclude));
      }
      else
      {
        unset($collection[$key]);
      }
    }

    return $collection;
  }
296917
public function only($keys)
    {
        $keys = is_array($keys) ? $keys : func_get_args();

        $results = [];
        foreach ($keys as $key) {
            $results = array_merge_recursive($results, $this->buildArray(explode('.', $key), $this->get($key)));
        }

        return $results;
    }
650777
public function except($keys): CollectionInterface
    {
        if (!is_callable($keys)) {
            if (!is_array($keys)) {
                $keys = func_get_args();
            }
            $keys = function ($item, $key) use ($keys) {
                return in_array($key, $keys, false);
            };
        }

        return $this->wrap(function (Iterator $data) use ($keys) {
            foreach ($data as $key => $item) {
                if (!$keys($item, $key)) {
                    yield $key => $item;
                }
            }
        });
    }
1042700
public function parseExcludes($excludes)
    {
        $this->requestedExcludes = [];

        if (is_string($excludes)) {
            $excludes = explode(',', $excludes);
        }

        if (! is_array($excludes)) {
            throw new \InvalidArgumentException(
                'The parseExcludes() method expects a string or an array. '.gettype($excludes).' given'
            );
        }

        foreach ($excludes as $excludeName) {
            $excludeName = $this->trimToAcceptableRecursionLevel($excludeName);

            if (in_array($excludeName, $this->requestedExcludes)) {
                continue;
            }

            $this->requestedExcludes[] = $excludeName;
        }

        return $this;
    }
607520
public function getMixableMethods($exclude = array())
    {
        $exclude = array_merge($exclude, array('getNodes'));
        $methods = parent::getMixableMethods($exclude);

        return $methods;
    }
366306
public function only($keys)
    {
        $results = [];

        $input = $this->all();

        $placeholder = new stdClass;

        foreach (is_array($keys) ? $keys : func_get_args() as $key) {
            $value = data_get($input, $key, $placeholder);

            if ($value !== $placeholder) {
                Arr::set($results, $key, $value);
            }
        }

        return $results;
    }