src/ClassGeneration/ConstantCollection.php
public function add($constant)
    {
        if (!$constant instanceof ConstantInterface) {
            throw new \InvalidArgumentException(
                'This Constant must be a instance of \ClassGeneration\ConstantInterface'
            );
        }

        if ($constant->getName() === null) {
            $constant->setName('constant' . ($this->count() + 1));
        }

        return parent::add($constant);
    }
public function add($constant)
    {
        if (!$constant instanceof ConstantInterface) {
            throw new \InvalidArgumentException(
                'This Constant must be a instance of \ClassGeneration\ConstantInterface'
            );
        }

        if ($constant->getName() === null) {
            $constant->setName('constant' . ($this->count() + 1));
        }

        return parent::add($constant);
    }
public function add ( $ constant ) { if ( ! $ constant instanceof ConstantInterface ) { throw new \ InvalidArgumentException ( 'This Constant must be a instance of \ClassGeneration\ConstantInterface' ) ; } if ( $ constant -> getName ( ) === null ) { $ constant -> setName ( 'constant' . ( $ this -> count ( ) + 1 ) ) ; } return parent :: add ( $ constant ) ; }
Adds a new Constant at ConstantCollection.

@param ConstantInterface $constant

@throws \InvalidArgumentException
@return bool
Adds a new Constant at ConstantCollection .