/** * @return Parameter[] */ public function parameters() { $analyzer = new MethodAnalyzer($this->method); $parameters = []; foreach ($this->method->getParameters() as $parameter) { $type = $analyzer->getType($parameter, $this->types); $parameters[] = (new Parameter($parameter->name, $type, !$parameter->isDefaultValueAvailable()))->setDescription($this->parser->parse($analyzer->getComment($parameter))); } return $parameters; }
/** * @return Parameter[] * @throws \Exception */ public function parameters() { $parameters = []; foreach ($this->reader->readInterface() as $property) { if ($property->canSet()) { $parameters[] = (new Parameter($property->name(), $property->type(), $property->isRequired()))->setDescription($this->parser->parse($property->comment())); } } return $parameters; }
/** * @param ActionListItem[] $actions * @return Element */ private function renderList($actions) { $items = []; foreach ($actions as $action) { $caption = [$action->getCaption()]; if ($action->getDescription()) { $caption[] = new Element('small', [], ['- ' . $this->parser->shorten($action->getDescription())]); } $items[] = new Element('a', ['href' => $action->getId(), 'class' => 'list-group-item'], $caption); } return new Element('div', ['class' => 'list-group'], $items); }
public function parse($comment) { if (class_exists(\Parsedown::class)) { return (new \Parsedown())->text($comment); } return nl2br(parent::parse($comment)); }
private function assembleActions() { $actions = []; foreach ($this->actions->getAllActions() as $id => $action) { if ($id != WebApplication::INDEX_ACTION && $this->access->isPermitted($id)) { $actions[] = new ActionListItem($id, $action->caption(), $this->parser->shorten($action->description())); } } return $actions; }
private function shortDescription(Action $action) { $description = $this->parser->shorten($action->description()); return $description ? " ({$description})" : ''; }