Пример #1
0
 /**
  * @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;
 }
Пример #2
0
 /**
  * @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;
 }
Пример #3
0
 /**
  * @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);
 }
Пример #4
0
 public function parse($comment)
 {
     if (class_exists(\Parsedown::class)) {
         return (new \Parsedown())->text($comment);
     }
     return nl2br(parent::parse($comment));
 }
Пример #5
0
 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;
 }
Пример #6
0
 private function shortDescription(Action $action)
 {
     $description = $this->parser->shorten($action->description());
     return $description ? " ({$description})" : '';
 }