require __DIR__ . '/routes.php', Router::class => factory(function (ContainerInterface $c) { $router = (new RouterFactory())->newInstance(); // Add the routes from the array config (Aura router doesn't seem to accept routes as array) $routes = $c->get('routes'); foreach ($routes as $routeName => $route) { $router->add($routeName, $route['pattern']) ->addValues(['controller' => $route['controller']]); } return $router; }), // Badge generator Poser::class => factory(function () { return new Poser([new SvgRender()]); }), // Twig Twig_Environment::class => factory(function (ContainerInterface $c) { $loader = new Twig_Loader_Filesystem(__DIR__ . '/../../src/Maintained/Application/View'); $twig = new Twig_Environment($loader); $twig->addExtension($c->get(TwigExtension::class)); return $twig; }), // Cache 'cache.directory' => __DIR__ . '/../../app/cache', Cache::class => factory(function (ContainerInterface $c) { $cache = new FilesystemCache($c->get('cache.directory') . '/app'); $cache->setNamespace('Maintained'); return $cache; }), // GitHub API Client::class => factory(function (ContainerInterface $c) { $cacheDirectory = $c->get('cache.directory') . '/github'; return new Client( new CachedHttpClient(['cache_dir' => $cacheDirectory]) ); }), StatisticsProvider::class => object(CachedStatisticsProvider::class) ->constructorParameter('wrapped', link(StatisticsComputer::class)), ClearCacheCommand::class => object() ->lazy() ->constructorParameter('cacheDirectory', link('cache.directory')), ];