示例#1
0
 public function testUnique()
 {
     $set = new Set();
     $set->add('hello', 'world', 'hello', 'hello', '!', 'world');
     $expected = 'helloworld!';
     $this->assertEquals($expected, $set->unique()->join(''));
     $set = new Set(array(array(1, 2, 3), array(3), array(3, 5, 5), array(1), array(1, 2)));
     $newSet = $set->unique(function ($a, $b) {
         return \count($a) === \count($b);
     });
     $this->assertCount(3, $newSet);
 }