/**
  * Adds a new Composition at CompositionCollection.
  *
  * @param string $composition
  *
  * @return bool
  */
 public function add($composition)
 {
     if (!$this->contains($composition)) {
         parent::add($composition);
     }
     return true;
 }
 /**
  * Adds a new Use on the collection.
  *
  * @param UseInterface $use
  *
  * @throws \InvalidArgumentException
  * @return bool
  */
 public function add($use)
 {
     if (!$use instanceof UseInterface) {
         throw new \InvalidArgumentException('This Property must be a instance of \\ClassGeneration\\UseInterface');
     }
     return parent::add($use);
 }
 /**
  * @param MethodInterface $method
  * @return bool
  */
 public function add($method)
 {
     if (!$method instanceof MethodInterface) {
         throw new \InvalidArgumentException('This Method must be a instance of \\ClassGeneration\\Composition\\MethodInterface');
     }
     parent::set($method->getTraitName() . '.' . $method->getName(), $method);
     return true;
 }
 /**
  * Adds a new Method on collection.
  *
  * @param MethodInterface $method
  *
  * @return bool
  *
  * @throws \InvalidArgumentException
  */
 public function add($method)
 {
     if (!$method instanceof MethodInterface) {
         throw new \InvalidArgumentException('This Method must be a instance of \\ClassGeneration\\MethodInterface');
     }
     if ($method->getName() === null) {
         $method->setName('method' . ($this->count() + 1));
     }
     parent::set($method->getName(), $method);
     return true;
 }
 /**
  * Add a Argument on collection.<br />
  * The index is a argument name, then will replace
  * if exist a index with the same name.
  *
  * @param ArgumentInterface $argument
  *
  * @throws \InvalidArgumentException
  * @return boolean
  */
 public function add($argument)
 {
     if (!$argument instanceof ArgumentInterface) {
         throw new \InvalidArgumentException('This Argument must be a instance of \\ClassGeneration\\ArgumentInterface');
     }
     if ($argument->getName() === null) {
         $argument->setName('param' . ($this->count() + 1));
     }
     parent::offsetSet($argument->getName(), $argument);
     return true;
 }
示例#6
0
 /**
  * This tag, has type?
  * @return bool
  */
 protected function needsType()
 {
     return $this->tagNeedsType->contains($this->getName());
 }
 public function testConvertArrayCollectionToArray()
 {
     $collection = new ArrayCollection(array('first', 'last'));
     $array = $collection->toArray();
     $this->assertTrue(is_array($array));
     $this->assertEquals('first', $array[0]);
 }
 /**
  * Gets the current Property.
  * @return Property
  */
 public function current()
 {
     return parent::current();
 }