public function filter(\Closure $callback)
    {
        $offsetToRemove = [];
        foreach ($this as $offset => $entity) {
            if (!$callback($entity)) {
                $offsetToRemove[] = $offset;
            }
        }
        $this->offsetUnset($offsetToRemove);
        return $this;
    }
public function filter(\Closure $callback)
    {
        $offsetToRemove = [];
        foreach ($this as $offset => $entity) {
            if (!$callback($entity)) {
                $offsetToRemove[] = $offset;
            }
        }
        $this->offsetUnset($offsetToRemove);
        return $this;
    }
public function filter ( \ Closure $ callback ) { $ offsetToRemove = [ ] ; foreach ( $ this as $ offset => $ entity ) { if ( ! $ callback ( $ entity ) ) { $ offsetToRemove [ ] = $ offset ; } } $ this -> offsetUnset ( $ offsetToRemove ) ; return $ this ; }
Filter collection from entities not matching criteria given in callback

@param \Closure $callback callback

@return static
Filter collection from entities not matching criteria given in callback