Exemplo n.º 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;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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);
 }
Exemplo n.º 4
0
 public function parse($comment)
 {
     if (class_exists(\Parsedown::class)) {
         return (new \Parsedown())->text($comment);
     }
     return nl2br(parent::parse($comment));
 }
Exemplo n.º 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;
 }
Exemplo n.º 6
0
 private function shortDescription(Action $action)
 {
     $description = $this->parser->shorten($action->description());
     return $description ? " ({$description})" : '';
 }