/**
  * Inject routes from configuration, if any.
  *
  * @param Application $app
  * @param ContainerInterface $container
  */
 private function injectRoutes(Application $app, ContainerInterface $container)
 {
     $config = $container->has('config') ? $container->get('config') : [];
     if (!isset($config['routes'])) {
         $app->pipeRoutingMiddleware();
         return;
     }
     foreach ($config['routes'] as $spec) {
         if (!isset($spec['path']) || !isset($spec['middleware'])) {
             continue;
         }
         $methods = isset($spec['allowed_methods']) && is_array($spec['allowed_methods']) ? $spec['allowed_methods'] : null;
         $name = isset($spec['name']) ? $spec['name'] : null;
         $methods = null === $methods ? Route::HTTP_METHOD_ANY : $methods;
         $route = new Route($spec['path'], $spec['middleware'], $methods, $name);
         if (isset($spec['options']) && is_array($spec['options'])) {
             $route->setOptions($spec['options']);
         }
         $app->route($route);
     }
 }