protected function setup_router()
    {
        // Only because you can't use $this->app in the callback
        $app       = $this->app;
        $file_list = $app['filesystem']->listContents($app['settings']['sonic.content_dir'], true);

        $files     = array_filter($file_list, function ($file) {
            return isset($file['extension']) && $file['extension'] === 'md'
                ? TRUE
                : FALSE;
        });

        // Add each as a route
        foreach ($files as $file) {

            // Get filename without extension
            $file_path = str_replace(
                $app['settings']['sonic.content_dir'],
                '',
                $file['dirname'] . '/' . $file['filename']
            );

            $route = '/' . trim(str_replace('/index', '/', $file_path), '/');

            $this->app['router']->route(new Routes\DefaultRoute($route));
        }
    }
protected function setup_router()
    {
        // Only because you can't use $this->app in the callback
        $app       = $this->app;
        $file_list = $app['filesystem']->listContents($app['settings']['sonic.content_dir'], true);

        $files     = array_filter($file_list, function ($file) {
            return isset($file['extension']) && $file['extension'] === 'md'
                ? TRUE
                : FALSE;
        });

        // Add each as a route
        foreach ($files as $file) {

            // Get filename without extension
            $file_path = str_replace(
                $app['settings']['sonic.content_dir'],
                '',
                $file['dirname'] . '/' . $file['filename']
            );

            $route = '/' . trim(str_replace('/index', '/', $file_path), '/');

            $this->app['router']->route(new Routes\DefaultRoute($route));
        }
    }
protected function setup_router ( ) { // Only because you can't use $this->app in the callback $ app = $ this -> app ; $ file_list = $ app [ 'filesystem' ] -> listContents ( $ app [ 'settings' ] [ 'sonic.content_dir' ] , true ) ; $ files = array_filter ( $ file_list , function ( $ file ) { return isset ( $ file [ 'extension' ] ) && $ file [ 'extension' ] === 'md' ? TRUE : FALSE ; } ) ; // Add each as a route foreach ( $ files as $ file ) { // Get filename without extension $ file_path = str_replace ( $ app [ 'settings' ] [ 'sonic.content_dir' ] , '' , $ file [ 'dirname' ] . '/' . $ file [ 'filename' ] ) ; $ route = '/' . trim ( str_replace ( '/index' , '/' , $ file_path ) , '/' ) ; $ this -> app [ 'router' ] -> route ( new Routes \ DefaultRoute ( $ route ) ) ; } }
Does the initial setup for the router. This entails creating the routes
for the application, mainly

@return
Does the initial setup for the router . This entails creating the routes for the application mainly