private function orderToc($baseRoute, $meta)
    {
        $defaults = [
            "orderby" => "section",
            "orderorder" => "asc",
        ];
        $options = array_merge($defaults, $meta);
        $orderby = $options["orderby"];
        $order   = $options["orderorder"];
        $toc = $this->meta[$baseRoute]["__toc__"];

        uksort($toc, function ($a, $b) use ($toc, $orderby, $order) {
                $a = $toc[$a][$orderby];
                $b = $toc[$b][$orderby];

                $asc = $order == "asc" ? 1 : -1;
                
            if ($a == $b) {
                return 0;
            } elseif ($a > $b) {
                return $asc;
            }
                return -$asc;
        });
        
        $this->meta[$baseRoute]["__toc__"] = $toc;
    }
private function orderToc($baseRoute, $meta)
    {
        $defaults = [
            "orderby" => "section",
            "orderorder" => "asc",
        ];
        $options = array_merge($defaults, $meta);
        $orderby = $options["orderby"];
        $order   = $options["orderorder"];
        $toc = $this->meta[$baseRoute]["__toc__"];

        uksort($toc, function ($a, $b) use ($toc, $orderby, $order) {
                $a = $toc[$a][$orderby];
                $b = $toc[$b][$orderby];

                $asc = $order == "asc" ? 1 : -1;
                
            if ($a == $b) {
                return 0;
            } elseif ($a > $b) {
                return $asc;
            }
                return -$asc;
        });
        
        $this->meta[$baseRoute]["__toc__"] = $toc;
    }
private function orderToc ( $ baseRoute , $ meta ) { $ defaults = [ "orderby" => "section" , "orderorder" => "asc" , ] ; $ options = array_merge ( $ defaults , $ meta ) ; $ orderby = $ options [ "orderby" ] ; $ order = $ options [ "orderorder" ] ; $ toc = $ this -> meta [ $ baseRoute ] [ "__toc__" ] ; uksort ( $ toc , function ( $ a , $ b ) use ( $ toc , $ orderby , $ order ) { $ a = $ toc [ $ a ] [ $ orderby ] ; $ b = $ toc [ $ b ] [ $ orderby ] ; $ asc = $ order == "asc" ? 1 : - 1 ; if ( $ a == $ b ) { return 0 ; } elseif ( $ a > $ b ) { return $ asc ; } return - $ asc ; } ) ; $ this -> meta [ $ baseRoute ] [ "__toc__" ] = $ toc ; }
Order toc items.

@param string $baseRoute route to use to find __toc__.
@param string $meta on how to order toc.

@return void.
Order toc items .