/** * @inheritdoc * * @param callable $func - If no callback is supplied, all entries of container equal to FALSE will be removed. * @param null $flag - Flag determining what arguments are sent to callback * - USE_KEY * - pass key as the only argument to callback instead of the value * - USE_BOTH * - pass both value and key as arguments to callback instead of the value * * @return HArray * * @throws \InvalidArgumentException */ public function filter(callable $func = null, $flag = null) { $answer = new Filter($this); return new static($answer->filter($func, $flag)); }
/** * @inheritdoc * * @return HString * * @throws \InvalidArgumentException */ public function filter(callable $func = null, $flag = null) { $answer = new Filter($this->toHArray()); return new static((new HArray($answer->filter($func, $flag)))->toHString()); }