public static function finalizeTree(Directory $current, $prev = null)
    {
        foreach ($current->getEntries() as $entry) {
            if ($entry instanceof Directory) {
                $prev = Builder::finalizeTree($entry, $prev);
            } elseif ($entry instanceof Content) {
                if ($prev) {
                    $prev->setNext($entry);
                    $entry->setPrevious($prev);
                }

                $prev = $entry;
            }
        }

        return $prev;
    }
public static function finalizeTree(Directory $current, $prev = null)
    {
        foreach ($current->getEntries() as $entry) {
            if ($entry instanceof Directory) {
                $prev = Builder::finalizeTree($entry, $prev);
            } elseif ($entry instanceof Content) {
                if ($prev) {
                    $prev->setNext($entry);
                    $entry->setPrevious($prev);
                }

                $prev = $entry;
            }
        }

        return $prev;
    }
public static function finalizeTree ( Directory $ current , $ prev = null ) { foreach ( $ current -> getEntries ( ) as $ entry ) { if ( $ entry instanceof Directory ) { $ prev = Builder :: finalizeTree ( $ entry , $ prev ) ; } elseif ( $ entry instanceof Content ) { if ( $ prev ) { $ prev -> setNext ( $ entry ) ; $ entry -> setPrevious ( $ prev ) ; } $ prev = $ entry ; } } return $ prev ; }
Calculate next and previous for all pages

@param Directory $current
@param null|Content $prev
@return null|Content
Calculate next and previous for all pages