set(HelloWorldController::class, function (ContainerInterface $c) { return new HelloWorldController( $c->get(self::TWIG), $c->get(HelloWorld::class) ); }); // Services $container->set(HelloWorld::class, function () { return new HelloWorld(); }); $container->set(self::TWIG, function (ContainerInterface $c) { // TODO cache $twigSettings = []; return Twig::create(self::TWIG_TEMPLATE_DIR, $twigSettings); }); return $container; } }