コード例 #1
0
ファイル: TableCollection.php プロジェクト: dazarobbo/cola
 public function add(Table &$table = null)
 {
     if ($this->Some(function ($t) use($table) {
         return $t->getName() === $table->getName();
     })) {
         throw new \DomainException('Table name must be unique in this collection');
     }
     return parent::Add($table);
 }
コード例 #2
0
ファイル: SetTest.php プロジェクト: dazarobbo/cola
 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);
 }
コード例 #3
0
ファイル: TypeCollection.php プロジェクト: dazarobbo/cola
 public function addType(Type $t)
 {
     return parent::Add($t);
 }