示例#1
0
 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);
     }
 }
示例#2
0
function filter($repeatable, PredicateInterface $predicate)
{
    return Repeatables::filter($repeatable, $predicate);
}