Beispiel #1
0
 /**
  * Appends the $value to the collection.
  * 
  * @param mixed $value
  * @param bool TRUE if the element has been appended successfully
  */
 public function append($value)
 {
     if ($this->guard !== null) {
         $this->guard->checkMemberGuard(new GuardPermission(__FUNCTION__, 'call'));
     }
     $this->set->append($value);
 }
Beispiel #2
0
}
try {
    echo "Construct from array\n";
    $arr = array($jack, $mary, $foo);
    $set2 = new Set($arr, 'Person');
} catch (Exception $e) {
    echo get_class($e), ': ', $e->getMessage(), "\n\n";
}
// readonly collection
echo "Construct as readonly\n";
$set2 = new Set($arr);
$set2->freeze();
Debug::dump($set2->isFrozen());
try {
    echo "Adding Jack\n";
    Debug::dump($set2->append($jack));
} catch (Exception $e) {
    echo get_class($e), ': ', $e->getMessage(), "\n\n";
}
try {
    echo "Removing Jack\n";
    $set2->remove($jack);
} catch (Exception $e) {
    echo get_class($e), ': ', $e->getMessage(), "\n\n";
}
try {
    echo "Clearing\n";
    $set2->clear();
} catch (Exception $e) {
    echo get_class($e), ': ', $e->getMessage(), "\n\n";
}