Esempio n. 1
0
 public function testClear()
 {
     $set1 = new Set([1, 6, 4, 3]);
     $this->assertEquals($set1->size(), 4);
     $set1->clear();
     $this->assertTrue($set1->isEmpty());
     $this->assertEquals($set1->size(), 0);
     $set1->add('foo');
     $this->assertEquals($set1->count(), 1);
 }
Esempio n. 2
0
 /**
  * Checks if the collection is empty or not.
  * 
  * @return bool TRUE if the collection does not contain any element, FALSE otherwise.
  */
 public function isEmpty()
 {
     if ($this->guard !== null) {
         $this->guard->checkMemberGuard(new GuardPermission(__FUNCTION__, 'call'));
     }
     return $this->set->isEmpty();
 }