Implement YAML config loader

This commit is contained in:
Lexi / Zoe 2021-09-25 23:56:04 +02:00
parent 14c22e0e6c
commit 6c41f06105
Signed by: binaryDiv
GPG key ID: F8D4956E224DA232
14 changed files with 169 additions and 9 deletions

View file

@ -70,10 +70,23 @@ class AppConfig
return $this->dateTimeFormat;
}
public function getTwigCacheDir(): ?string
{
if (empty($this->twigCacheDir)) {
return null;
} elseif (substr($this->twigCacheDir, 0, 1) === '/') {
// Absolute path
return $this->twigCacheDir;
} else {
// Relative path
return ROOT_DIR . '/' . $this->twigCacheDir;
}
}
public function getTwigSettings(): array
{
return [
'cache' => $this->twigCacheDir ?: false,
'cache' => $this->getTwigCacheDir() ?: false,
'debug' => $this->isDebugMode(),
'strict_variables' => $this->isDebugMode(),
];