public function filter(callable $function, $recursive = false)
    {
        if ( ! $this->getBoolable($recursive))
        {
            return new static(array_filter($this->items, $function));
        }

        return new static($this->filterRecursive($function, $this->items));
    }
public function filter(callable $function, $recursive = false)
    {
        if ( ! $this->getBoolable($recursive))
        {
            return new static(array_filter($this->items, $function));
        }

        return new static($this->filterRecursive($function, $this->items));
    }
public function filter ( callable $ function , $ recursive = false ) { if ( ! $ this -> getBoolable ( $ recursive ) ) { return new static ( array_filter ( $ this -> items , $ function ) ) ; } return new static ( $ this -> filterRecursive ( $ function , $ this -> items ) ) ; }
Return filtered Container.
You can specify recursive filter with the second argument.

@param callable $function
@param bool|BooleanContract $recursive
@return Container
Return filtered Container . You can specify recursive filter with the second argument .