src/AbstractCollectionPlus.php
public function filter($func = null)
    {
        if (null === $func)
            return $this->initNew(array_filter($this->_storage));

        if (is_callable($func, false))
            return $this->initNew(array_filter($this->_storage, $func));

        throw new \InvalidArgumentException(vsprintf(
            '%s::filter - Un-callable "$func" value seen!',
            array(get_class($this)))
        );
    }
public function filter($func = null)
    {
        if (null === $func)
            return $this->initNew(array_filter($this->_storage));

        if (is_callable($func, false))
            return $this->initNew(array_filter($this->_storage, $func));

        throw new \InvalidArgumentException(vsprintf(
            '%s::filter - Un-callable "$func" value seen!',
            array(get_class($this)))
        );
    }
public function filter ( $ func = null ) { if ( null === $ func ) return $ this -> initNew ( array_filter ( $ this -> _storage ) ) ; if ( is_callable ( $ func , false ) ) return $ this -> initNew ( array_filter ( $ this -> _storage , $ func ) ) ; throw new \ InvalidArgumentException ( vsprintf ( '%s::filter - Un-callable "$func" value seen!' , array ( get_class ( $ this ) ) ) ) ; }
Applies array_filter to internal collection, returns new instance with resulting values.

@link http://www.php.net/manual/en/function.array-filter.php

Inspired by:

@link http://www.doctrine-project.org/api/common/2.3/source-class-Doctrine.Common.Collections.ArrayCollection.html#377-387

@param callable $func
@throws \InvalidArgumentException
@return \DCarbone\CollectionPlusInterface
Applies array_filter to internal collection returns new instance with resulting values .