Example #1
0
 /**
  * Adds the specified element to this set if it is not already present (optional operation).
  *
  * @param mixed $element
  * @return bool true if this set did not already contain the specified element
  */
 public function add($element)
 {
     if ($this->contains($element)) {
         return false;
     }
     return parent::add($element);
 }
Example #2
0
 /**
  * Adds an model to this collection.
  * Is used during initial collection construction.
  *
  * @param   Model   $model
  * @return  self
  */
 protected function add(Model $model)
 {
     parent::add($model);
     if (false === $this->hasOriginal($model)) {
         $this->original[] = $model;
     }
     return $this;
 }