public static function build($node, $ignore)
{
if (($it = new \FilesystemIterator($node->getPath())) == false) {
return;
}
if ($node instanceof Root) {
// Ignore config.json in the root directory
$ignore['files'][] = 'config.json';
}
/** @var \SplFileInfo $file */
foreach ($it as $file) {
if (static::isIgnored($file, $ignore)) {
continue;
}
if ($file->isDir()) {
$new = new Directory($node, static::removeSortingInformations($file->getFilename()), $file);
$new->setName(static::getName($file->getPathName()));
$new->setTitle(str_replace('_', ' ', static::removeSortingInformations($new->getName())));
static::build($new, $ignore);
} else {
static::createContent($node, $file);
}
}
$node->sort();
}
protected function getTree(Config $config) { $structure = ['Content' => ['Page.md' => 'some text content'], 'Widgets' => ['Page.md' => 'another page', 'Button.md' => 'another page']]; $root = vfsStream::setup('root', null, $structure); $config->setDocumentationDirectory($root->url()); $config['valid_content_extensions'] = ['md']; $config['mode'] = Daux::STATIC_MODE; $config['index_key'] = 'index.html'; $tree = new Root($config); Builder::build($tree, []); return $tree; }