<?php
namespace PHPFUI\InstaDoc\Section;
class Home extends \PHPFUI\InstaDoc\Section
{
public function generate(\PHPFUI\InstaDoc\PageInterface $page, string $fullClassPath) : \PHPFUI\Container
{
$container = new \PHPFUI\Container();
$parsedown = new \PHPFUI\InstaDoc\MarkDownParser();
$hr = '';
foreach ($this->controller->getHomePageMarkdown() as $file)
{
$container->add($hr);
$hr = '<hr>';
$container->add($parsedown->fileText($file));
}
$accordion = new \PHPFUI\Accordion();
$accordion->addAttribute('data-multi-expand', 'true');
$accordion->addAttribute('data-allow-all-closed', 'true');
$container->add(new \PHPFUI\SubHeader('Package Documentation'));
foreach (\PHPFUI\InstaDoc\NamespaceTree::getAllMDFiles() as $file)
{
$parts = \explode('/', \str_replace('\\', '/', $file));
\array_shift($parts);
$section = \array_pop($parts);
$section = \substr($section, 0, \strlen($section) - 3);
$section = \str_replace('_', ' ', \ucwords(\strtolower($section)));
$accordion->addTab(\implode('\\', $parts) . ' ' . $section, $parsedown->fileText($file));
}
$container->add($accordion);
return $container;
}
}