public function build(array $config)
    {
        $router = new Router();
        foreach ($config as $name => $route) {
            if ($route instanceof RouteInterface) {
                $router->register($name, $route);
                continue;
            }

            $route = $this->applyDefaults($route);

            $router->register(
                $name,
                $this->createDefinition($route)
            );
        }

        return $router;
    }