/** * @param object $value * @return mixed */ public function render($value) { if (method_exists($value, '__toString')) { return (string) $value; } return (string) new Element('div', ['class' => 'panel panel-info'], [new Element('div', ['class' => 'panel-heading clearfix'], [new Element('h3', ['class' => 'panel-title'], [htmlentities((new \ReflectionClass($value))->getShortName()), new Element('small', ['class' => 'pull-right'], $this->links->createLinkElements($value))])]), new Element('div', ['class' => 'panel-body'], [(new MapRenderer($this->renderers, $this->links))->renderArray($this->getProperties($value))])]); }
/** * @param array $array * @return mixed */ public function render($array) { $content = [new Element('div', ['class' => 'panel-body'], [$this->renderArray($array)])]; $links = $this->links->createLinkElements($array); if ($links) { array_unshift($content, new Element('div', ['class' => 'panel-heading clearfix'], [new Element('small', ['class' => 'pull-right'], $links)])); } return new Element('div', ['class' => 'panel panel-default'], $content); }
/** * @param Identifier $value * @return mixed */ public function render($value) { $caption = (new \ReflectionClass($value->getTarget()))->getShortName(); $out = $value->getId(); $dropDown = $this->links->createDropDown($value, $caption); if ($dropDown) { $out .= new Element('span', ['class' => 'pull-right'], $dropDown); } return $out; }
/** * @param Table $table * @return array * @throws \Exception */ private function renderRows($table) { $rows = []; foreach ($table->getItems() as $item) { $row = [new Element('td', [], $this->printer->createDropDown($item))]; foreach ($table->getCells($item) as $cell) { $row[] = new Element('td', [], [$this->renderers->getRenderer($cell)->render($cell)]); } $rows[] = new Element('tr', [], $row); } return $rows; }