This repository has been archived on 2026-03-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blog-slim.old/src/Config.php
2026-03-09 16:07:17 +01:00

35 lines
711 B
PHP

<?php
declare(strict_types=1);
namespace App;
final class Config
{
public static function getTwigCache(bool $isDev): string|bool
{
if ($isDev) {
return false;
}
$path = __DIR__ . '/../var/cache/twig';
if (!is_dir($path)) {
@mkdir($path, 0755, true);
}
return $path;
}
public static function getDatabasePath(): string
{
$path = __DIR__ . '/../database/app.sqlite';
$dir = dirname($path);
if (!is_dir($dir)) {
@mkdir($dir, 0755, true);
}
if (!file_exists($path)) {
@touch($path);
@chmod($path, 0664);
}
return $path;
}
}