/** * @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); }