public function loadRoutes(App $slim, array $routes)
    {
        foreach ($routes as $name => $details) {
            if ($children = $this->nullable('routes', $details)) {
                $middlewares = $this->nullable('stack', $details) ?: [];
                $prefix = $this->nullable('route', $details) ?: '';

                $loader = [$this, 'loadRoutes'];
                $groupLoader = function () use ($slim, $children, $loader) {
                    $loader($slim, $children);
                };

                $group = $slim->group($prefix, $groupLoader);
                while ($mw = array_pop($middlewares)) {
                    $group->add($mw);
                }

            } else {
                $this->loadRoute($slim, $name, $details);
            }
        }
    }
public function loadRoutes(App $slim, array $routes)
    {
        foreach ($routes as $name => $details) {
            if ($children = $this->nullable('routes', $details)) {
                $middlewares = $this->nullable('stack', $details) ?: [];
                $prefix = $this->nullable('route', $details) ?: '';

                $loader = [$this, 'loadRoutes'];
                $groupLoader = function () use ($slim, $children, $loader) {
                    $loader($slim, $children);
                };

                $group = $slim->group($prefix, $groupLoader);
                while ($mw = array_pop($middlewares)) {
                    $group->add($mw);
                }

            } else {
                $this->loadRoute($slim, $name, $details);
            }
        }
    }
public function loadRoutes ( App $ slim , array $ routes ) { foreach ( $ routes as $ name => $ details ) { if ( $ children = $ this -> nullable ( 'routes' , $ details ) ) { $ middlewares = $ this -> nullable ( 'stack' , $ details ) ? : [ ] ; $ prefix = $ this -> nullable ( 'route' , $ details ) ? : '' ; $ loader = [ $ this , 'loadRoutes' ] ; $ groupLoader = function ( ) use ( $ slim , $ children , $ loader ) { $ loader ( $ slim , $ children ) ; } ; $ group = $ slim -> group ( $ prefix , $ groupLoader ) ; while ( $ mw = array_pop ( $ middlewares ) ) { $ group -> add ( $ mw ) ; } } else { $ this -> loadRoute ( $ slim , $ name , $ details ) ; } } }
Load routes into the application.

@param App $slim
@param array $routes

@return null
Load routes into the application .