private function discoverRoutes()
    {
        // Where are our routes located?
        $parentRoutes = $this->config->paths->theme->parent->routes;
        $childRoutes = $this->config->paths->theme->child->routes;
        $files = $this->finder->createFinder()->files()->name('*.php')->in($parentRoutes);
        if ($parentRoutes != $childRoutes && is_dir($childRoutes))
        {
            $files = $files->in($childRoutes);
        }

        // Collect all the files
        $splFiles = []; foreach ($files as $file) $splFiles[] = $file;

        // Now we need to sort them ourselves because it seems Finder's
        // sortByName(), only sorts per in('dir') and not across the
        // entire list.
        $orderedFiles = Linq::from($splFiles)->orderBy('$v', function($a, $b)
        {
            return strnatcasecmp
            (
                $a->getBasename('.php'),
                $b->getBasename('.php')
            );
        });

        // Finally lets add some routes.
        foreach ($orderedFiles as $file)
        {
            $route = import($file->getRealPath(), ['route' => $this->routes]);

            if (is_callable($route))
            {
                $this->container->call($route, ['config' => $this->config]);
            }
        }
    }
private function discoverRoutes()
    {
        // Where are our routes located?
        $parentRoutes = $this->config->paths->theme->parent->routes;
        $childRoutes = $this->config->paths->theme->child->routes;
        $files = $this->finder->createFinder()->files()->name('*.php')->in($parentRoutes);
        if ($parentRoutes != $childRoutes && is_dir($childRoutes))
        {
            $files = $files->in($childRoutes);
        }

        // Collect all the files
        $splFiles = []; foreach ($files as $file) $splFiles[] = $file;

        // Now we need to sort them ourselves because it seems Finder's
        // sortByName(), only sorts per in('dir') and not across the
        // entire list.
        $orderedFiles = Linq::from($splFiles)->orderBy('$v', function($a, $b)
        {
            return strnatcasecmp
            (
                $a->getBasename('.php'),
                $b->getBasename('.php')
            );
        });

        // Finally lets add some routes.
        foreach ($orderedFiles as $file)
        {
            $route = import($file->getRealPath(), ['route' => $this->routes]);

            if (is_callable($route))
            {
                $this->container->call($route, ['config' => $this->config]);
            }
        }
    }
private function discoverRoutes ( ) { // Where are our routes located? $ parentRoutes = $ this -> config -> paths -> theme -> parent -> routes ; $ childRoutes = $ this -> config -> paths -> theme -> child -> routes ; $ files = $ this -> finder -> createFinder ( ) -> files ( ) -> name ( '*.php' ) -> in ( $ parentRoutes ) ; if ( $ parentRoutes != $ childRoutes && is_dir ( $ childRoutes ) ) { $ files = $ files -> in ( $ childRoutes ) ; } // Collect all the files $ splFiles = [ ] ; foreach ( $ files as $ file ) $ splFiles [ ] = $ file ; // Now we need to sort them ourselves because it seems Finder's // sortByName(), only sorts per in('dir') and not across the // entire list. $ orderedFiles = Linq :: from ( $ splFiles ) -> orderBy ( '$v' , function ( $ a , $ b ) { return strnatcasecmp ( $ a -> getBasename ( '.php' ) , $ b -> getBasename ( '.php' ) ) ; } ) ; // Finally lets add some routes. foreach ( $ orderedFiles as $ file ) { $ route = import ( $ file -> getRealPath ( ) , [ 'route' => $ this -> routes ] ) ; if ( is_callable ( $ route ) ) { $ this -> container -> call ( $ route , [ 'config' => $ this -> config ] ) ; } } }
Finds all theme route files and adds the routes to the RouteCollection.

@return void
Finds all theme route files and adds the routes to the RouteCollection .