public function testFilterInstances() { $predicate = _instanceOf(\ArrayIterator::class); $repeatable = [1, 3, 4, new \ArrayIterator(), 5, 6, new \ArrayIterator()]; $results = Repeatables::filter($repeatable, $predicate); $this->assertTrue(is_array($results)); $this->assertEquals(2, count($results)); foreach ($results as $result) { $this->assertInstanceOf(\ArrayIterator::class, $result); } }
function filter($repeatable, PredicateInterface $predicate) { return Repeatables::filter($repeatable, $predicate); }