public function filter($closure = null, int $flag = \ARRAY_FILTER_USE_BOTH): self
    {
        if (!$closure) {
            return $this->clean();
        }

        return static::create(
            \array_filter($this->getArray(), $closure, $flag),
            $this->iteratorClass,
            false
        );
    }
public function filter($closure = null, int $flag = \ARRAY_FILTER_USE_BOTH): self
    {
        if (!$closure) {
            return $this->clean();
        }

        return static::create(
            \array_filter($this->getArray(), $closure, $flag),
            $this->iteratorClass,
            false
        );
    }
public function filter ( $ closure = null , int $ flag = \ ARRAY_FILTER_USE_BOTH ) : self { if ( ! $ closure ) { return $ this -> clean ( ) ; } return static :: create ( \ array_filter ( $ this -> getArray ( ) , $ closure , $ flag ) , $ this -> iteratorClass , false ) ; }
Find all items in an array that pass the truth test.

@param \Closure|null $closure [optional] <p>
The callback function to use
</p>
<p>
If no callback is supplied, all entries of
input equal to false (see
converting to
boolean) will be removed.
</p>
* @param int $flag [optional] <p>
Flag determining what arguments are sent to <i>callback</i>:
</p><ul>
<li>
<b>ARRAY_FILTER_USE_KEY</b> [1] - pass key as the only argument
to <i>callback</i> instead of the value</span>
</li>
<li>
<b>ARRAY_FILTER_USE_BOTH</b> [2] - pass both value and key as
arguments to <i>callback</i> instead of the value</span>
</li>
</ul>

@return static
<p>(Immutable)</p>
Find all items in an array that pass the truth test .