add Settings class and Twig cache settings
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
92a4d2fcf8
commit
808681e87a
6 changed files with 39 additions and 6 deletions
|
|
@ -16,6 +16,19 @@ class Dependencies
|
|||
{
|
||||
$container = new Container();
|
||||
|
||||
// App settings
|
||||
$container->set(Settings::class, function (): Settings {
|
||||
return new Settings();
|
||||
});
|
||||
|
||||
// Twig template engine
|
||||
$container->set(self::TWIG, function (ContainerInterface $c) {
|
||||
/** @var Settings $settings */
|
||||
$settings = $c->get(Settings::class);
|
||||
|
||||
return Twig::create(self::TWIG_TEMPLATE_DIR, $settings->getTwigSettings());
|
||||
});
|
||||
|
||||
// Controllers
|
||||
$container->set(HelloWorldController::class, function (ContainerInterface $c) {
|
||||
return new HelloWorldController(
|
||||
|
|
@ -29,12 +42,6 @@ class Dependencies
|
|||
return new HelloWorld();
|
||||
});
|
||||
|
||||
$container->set(self::TWIG, function (ContainerInterface $c) {
|
||||
// TODO cache
|
||||
$twigSettings = [];
|
||||
return Twig::create(self::TWIG_TEMPLATE_DIR, $twigSettings);
|
||||
});
|
||||
|
||||
return $container;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue