From fc92d5d30294bd6e4c3bb749d2802c4093e17189 Mon Sep 17 00:00:00 2001 From: Chris Kankiewicz Date: Sat, 9 Nov 2019 00:28:17 -0700 Subject: [PATCH] Set default values for values retrieved from the config --- app/Bootstrap/ViewComposer.php | 4 ++-- index.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Bootstrap/ViewComposer.php b/app/Bootstrap/ViewComposer.php index 8716ac4..39a37c2 100644 --- a/app/Bootstrap/ViewComposer.php +++ b/app/Bootstrap/ViewComposer.php @@ -17,12 +17,12 @@ class ViewComposer public function __invoke(Config $config, Twig $twig): void { $twig->getEnvironment()->getExtension(CoreExtension::class)->setDateFormat( - $config->get('date_format'), '%d days' + $config->get('date_format', 'Y-m-d H:i:s'), '%d days' ); $twig->getEnvironment()->addFunction( new TwigFunction('asset', function ($path) use ($config) { - return "/app/themes/{$config->get('theme')}/{$path}"; + return "/app/themes/{$config->get('theme', 'defualt')}/{$path}"; }) ); diff --git a/index.php b/index.php index 01268b8..9592e9a 100644 --- a/index.php +++ b/index.php @@ -21,7 +21,7 @@ $container = new Container(); $container->set(Config::class, new Config('app/config')); $container->set(Twig::class, function (Config $config) { return new Twig("app/themes/{$config->get('theme')}", [ - 'cache' => $config->get('view_cache') + 'cache' => $config->get('view_cache', 'app/cache/views') ]); });