예제 #1
0
 /**
  * Append an entity to the collection.
  * 
  * @param EntityInterface $entity
  * @throws Exception\InvalidEntityException
  */
 public function append(EntityInterface $entity)
 {
     if (!$this->isAllowed($entity)) {
         throw new Exception\InvalidEntityException(sprintf("Invalid entity '%s' for collection '%s'", get_class($entity), get_class($this)));
     }
     $this->entities->append($entity);
 }
예제 #2
0
 public function testAppend()
 {
     $ar = new ArrayObject(array('one', 'two'));
     $this->assertEquals(2, $ar->count());
     $ar->append('three');
     $this->assertSame('three', $ar[2]);
     $this->assertEquals(3, $ar->count());
 }
예제 #3
0
 /**
  * Add constant to list
  *
  * @param string $constant
  *
  * @return $this
  */
 public function addConstant($constant)
 {
     $this->constants->append($constant);
     return $this;
 }
예제 #4
0
 /**
  * Only allow Vector2D objects to be appended
  *
  * @param \Chippyash\Matrix\Vector\Vector2D $value
  * @return \Chippyash\Matrix\Vector\VectorSet $this
  * @throws \Chippyash\Matrix\Exceptions\VectorException
  */
 public function append($value)
 {
     if (!$value instanceof Vector2D) {
         throw new VectorException('Append value is not a vector');
     }
     parent::append($value);
     return $this;
 }
예제 #5
0
 /**
  * {@inheritdoc}
  * @throws Exception\InvalidArgumentException
  */
 public function append($value)
 {
     $this->validateValue($value);
     return parent::append($value);
 }