add() public method

Attempts to add the value to the set, will fail if the value is already contained in the set.
public add ( mixed $value ) : boolean
$value mixed
return boolean Whether the value was successfully added
コード例 #1
0
ファイル: SetTest.php プロジェクト: timetoogo/pinq
 /**
  * @dataProvider sets
  */
 public function testThatSetCanRemoveAddedElements(ISet $set)
 {
     $set->add(0);
     $set->add(1);
     $this->assertCount(2, $set);
     $set->remove('0');
     $this->assertCount(2, $set);
     $set->remove(0);
     $this->assertCount(1, $set);
     $set->remove(1);
     $this->assertCount(0, $set);
 }