Zend\Code\Generator\ClassGenerator::addConstantFromGenerator PHP Метод

addConstantFromGenerator() публичный Метод

Add constant from PropertyGenerator
public addConstantFromGenerator ( Zend\Code\Generator\PropertyGenerator $constant ) : self
$constant Zend\Code\Generator\PropertyGenerator
Результат self
    public function addConstantFromGenerator(PropertyGenerator $constant)
    {
        $constantName = $constant->getName();
        if (isset($this->constants[$constantName])) {
            throw new Exception\InvalidArgumentException(sprintf('A constant by name %s already exists in this class.', $constantName));
        }
        if (!$constant->isConst()) {
            throw new Exception\InvalidArgumentException(sprintf('The value %s is not defined as a constant.', $constantName));
        }
        $this->constants[$constantName] = $constant;
        return $this;
    }