Ejemplo n.º 1
0
 /**
  * Add element to Collection
  *
  * @author WN
  * @param mixed $element
  * @return $this
  * @throws InvalidElementException
  */
 public function add($element)
 {
     try {
         return parent::add($element);
     } catch (\Exception $e) {
         throw new InvalidElementException('Element is not instance of ' . $this->type);
     }
 }
Ejemplo n.º 2
0
 /**
  * Add element to Collection
  *
  * @author WN
  * @param mixed $element
  * @return $this
  * @throws InvalidElementException
  */
 public function add($element)
 {
     try {
         return parent::add($element);
     } catch (InvalidElementException $e) {
         throw new InvalidElementException('Expected element to be type of ' . $this->getTypeName($this->type));
     }
 }