/** * Build property * * @param ClassProperty $property * @param string $indent * @return string */ protected function buildProperty(ClassProperty $property, $indent) { $visibility = $property->isPublic() ? 'public' : $property->isProtected() ? 'protected' : 'private'; if ($property->isStatic()) { $visibility = 'static ' . $visibility; } $source = $visibility . ' $' . $property->getName(); $original = $property->getOriginal(); if (isset($original['default'])) { $source .= ' = ' . $this->wrapPHPValue(array('default' => $original['default'])); } $docBlock = new DocBlock($property->getDocBlock(), $indent); return $docBlock . "\n" . $indent . $source . ';'; }
/** * Adds a property to the definition * * @param ClassProperty $property * @throws CompilerException */ public function addProperty(ClassProperty $property) { if (isset($this->properties[$property->getName()])) { throw new CompilerException("Property '" . $property->getName() . "' was defined more than one time", $property->getOriginal()); } $this->properties[$property->getName()] = $property; }