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()) {
                $title = static::removeSortingInformations($file->getFilename());
                $new = new Directory($node, $title, $file);
                $new->setName(static::getName($file->getPathName()));
                $new->setTitle(str_replace('_', ' ', static::removeSortingInformations($new->getName())));
                static::build($new, $ignore);

                $index = $new->getLocalIndexPage();
                if ($index && $index->getTitle() != $title) {
                    $new->setTitle($index->getTitle());
                }
            } else {
                static::createContent($node, $file);
            }
        }

        $node->sort();
    }
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()) {
                $title = static::removeSortingInformations($file->getFilename());
                $new = new Directory($node, $title, $file);
                $new->setName(static::getName($file->getPathName()));
                $new->setTitle(str_replace('_', ' ', static::removeSortingInformations($new->getName())));
                static::build($new, $ignore);

                $index = $new->getLocalIndexPage();
                if ($index && $index->getTitle() != $title) {
                    $new->setTitle($index->getTitle());
                }
            } else {
                static::createContent($node, $file);
            }
        }

        $node->sort();
    }
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 ( ) ) { $ title = static :: removeSortingInformations ( $ file -> getFilename ( ) ) ; $ new = new Directory ( $ node , $ title , $ file ) ; $ new -> setName ( static :: getName ( $ file -> getPathName ( ) ) ) ; $ new -> setTitle ( str_replace ( '_' , ' ' , static :: removeSortingInformations ( $ new -> getName ( ) ) ) ) ; static :: build ( $ new , $ ignore ) ; $ index = $ new -> getLocalIndexPage ( ) ; if ( $ index && $ index -> getTitle ( ) != $ title ) { $ new -> setTitle ( $ index -> getTitle ( ) ) ; } } else { static :: createContent ( $ node , $ file ) ; } } $ node -> sort ( ) ; }
Build the initial tree

@param Directory $node
@param array $ignore
Build the initial tree