public static function parseConfig(array $config)
    {
        $collection = new RouteCollection();
        foreach ($config['routes'] as $name => $route) {
            $collection->attachRoute(new Route($route[0], array(
                '_controller' => str_replace('.', '::', $route[1]),
                'methods' => $route[2],
                'name' => $name
            )));
        }

        $router = new Router($collection);
        if (isset($config['base_path'])) {
            $router->setBasePath($config['base_path']);
        }

        return $router;
    }
public static function parseConfig(array $config)
    {
        $collection = new RouteCollection();
        foreach ($config['routes'] as $name => $route) {
            $collection->attachRoute(new Route($route[0], array(
                '_controller' => str_replace('.', '::', $route[1]),
                'methods' => $route[2],
                'name' => $name
            )));
        }

        $router = new Router($collection);
        if (isset($config['base_path'])) {
            $router->setBasePath($config['base_path']);
        }

        return $router;
    }
public static function parseConfig ( array $ config ) { $ collection = new RouteCollection ( ) ; foreach ( $ config [ 'routes' ] as $ name => $ route ) { $ collection -> attachRoute ( new Route ( $ route [ 0 ] , array ( '_controller' => str_replace ( '.' , '::' , $ route [ 1 ] ) , 'methods' => $ route [ 2 ] , 'name' => $ name ) ) ) ; } $ router = new Router ( $ collection ) ; if ( isset ( $ config [ 'base_path' ] ) ) { $ router -> setBasePath ( $ config [ 'base_path' ] ) ; } return $ router ; }
Create routes by array, and return a Router object

@param array $config provide by Config::loadFromFile()
@return Router
Create routes by array and return a Router object