/**
  * 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;
 }
 public function testOffsetSetInArrayCollection()
 {
     $collection = new ArrayCollection(array('element', 'last'));
     $collection->offsetSet(0, 'first');
     $collection->offsetSet(null, 'second');
     $this->assertEquals('first', $collection->first());
 }