/** * @param \ReflectionProperty $property * @return Property */ public static function createFromReflection(\ReflectionProperty $property) { $return = new Property(); $return->setName($property->getName()); $phpDoc = PhpDoc::parse($property->getDocComment()); if (array_key_exists('comments', $phpDoc)) { $return->setComments($phpDoc['comments']); } if (array_key_exists('@var', $phpDoc)) { $return->setType($phpDoc['@var'][0]['type']); } return $return; }
/** * @param string|array $comments * @param int $tabs * @param int $endOfLines * @return string */ public function getCodeForPhpDocComments($comments, $tabs = 0, $endOfLines = 1) { if (is_array($comments) === false) { $comments = ['comments' => $comments]; } $return = null; $phpDocs = PhpDoc::asString($comments); foreach ($phpDocs as $phpDoc) { $return .= $this->getCodeForLine($phpDoc, $tabs); } $return .= $this->getCodeForEndOfLines($endOfLines - 1); return $return; }