private function _getDc($data, $type = 'function') { $prefix = is_in($type, 'function', 'class') ? "{$type} {$data['name']}" : "{$type}{$data['name']}"; $dc = PhpDocComment::Parse($data['comment']); $is_private = starts_with($data['name'], '_') || contains($data['modifiers'], 'private', 'protected') || $dc && $dc->has('private'); if (!$dc) { if (!$is_private) { $this->_warn("{$prefix} MISSING DocComment", 'comment'); } return array(false, $is_private); } if ($dc->hasOne('internal', 'override', 'deprecated', 'shortcut', 'implements')) { return array($dc, $is_private); } if (!$is_private) { if (!$dc->ShortDesc) { $this->_warn("{$prefix} MISSING ShortDesc", 'short'); } if ($dc->LongDesc === false) { $this->_warn("{$prefix} MISSING LongDesc", 'long'); } } if ($type == 'class') { return array($dc, $is_private); } if (!$is_private && !$dc->has('return')) { $this->_warn("{$prefix} MISSING @return", 'return'); } return array($dc, $is_private); }
/** * Returns the DocComment for a method(or the class) as object * * This is the modern version of <WdfReflector::getCommentString>(). * @param string $method_name Name of method or false if you want the class comment * @return PhpDocComment The DocComment wrapped as PhpDocComment */ public function getCommentObject($method_name = false) { $comment = $this->_getComment($method_name); return PhpDocComment::Parse($comment); }