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;
}