public function filter(callable $closure)
    {
        $collection = new static();
        foreach ($this->data as $key => $value) {
            if ($closure($key, $value)) {
                $collection[$key] = $value;
            }
        }

        return $collection;
    }
public function filter(callable $closure)
    {
        $collection = new static();
        foreach ($this->data as $key => $value) {
            if ($closure($key, $value)) {
                $collection[$key] = $value;
            }
        }

        return $collection;
    }
public function filter ( callable $ closure ) { $ collection = new static ( ) ; foreach ( $ this -> data as $ key => $ value ) { if ( $ closure ( $ key , $ value ) ) { $ collection [ $ key ] = $ value ; } } return $ collection ; }
Iterates over each key value pair in the collection passing them to the
callable. If the callable returns true, the current value from input is
returned into the result Collection.

The callable must accept two arguments:
- (string) $key
- (string) $value

@param callable $closure Evaluation function

@return Collection
Iterates over each key value pair in the collection passing them to the callable . If the callable returns true the current value from input is returned into the result Collection .