From fa00b957378a393f8edbfc98ef111d35d18ecb09 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 24 Sep 2023 13:40:25 +0200 Subject: initial commit --- src/View.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/View.php (limited to 'src/View.php') diff --git a/src/View.php b/src/View.php new file mode 100644 index 0000000..5f9ca34 --- /dev/null +++ b/src/View.php @@ -0,0 +1,37 @@ + $_ENV['APP_ENV'] === 'development', + ]); + + self::$twig->addExtension(new DebugExtension()); + // self::$twig->addExtension(new IntlExtension()); + + self::$twig->addFilter(new TwigFilter('buildTime', function ($buildTime) { + return @sprintf('%02d:%02d:%02d', $buildTime / 3600, ($buildTime / 60) % 60, $buildTime % 60); + })); + } + + /** + * @param string $name + * @param array $context + */ + public static function render(string $name, array $context = []): string + { + return self::$twig->render($name, $context); + } +} -- cgit v1.2.3