/** * @param Property $property * @return $this */ public function addProperty(Property $property) { $this->properties[$property->getName()] = $property; return $this; }
/** * @param Property $property * @param int $tabs * @param int $endOfLines * @return string */ public function getCodeForProperty(Property $property, $tabs = 1, $endOfLines = 1) { $return = null; $comments = array('comments' => $property->getComments()); if ($property->getType() !== null) { $comments['@var'] = array('type' => $property->getType()); } $return .= $this->getCodeForPhpDocComments($comments, $tabs); $declaration = $this->getCodeForVisibility($property->getVisibility()); $declaration .= $this->getCodeForStatic($property->isStatic()); $declaration .= substr($property->getName(), 0, 1) == '$' ? $property->getName() : '$' . $property->getName(); if ($property->getDefaultValue() !== null) { $declaration .= ' = ' . $property->getDefaultValue(); } $declaration .= ';'; $return .= $this->getCodeForLine($declaration, $tabs, $endOfLines); return $return; }