$cache ?? false, 'strict_variables' => true, 'auto_reload' => $debug, 'debug' => $debug, ]); self::$env->addExtension(new TwigMisuzu($ctx)); } public static function addPath(string $path): void { self::$loader->addPath($path); } public static function renderRaw(string $file, array $vars = []): string { if(!defined('MSZ_TPL_RENDER')) { define('MSZ_TPL_RENDER', microtime(true)); } if(!str_ends_with($file, self::FILE_EXT)) { $file = str_replace('.', DIRECTORY_SEPARATOR, $file) . self::FILE_EXT; } return self::$env->render($file, array_merge(self::$vars, $vars)); } public static function render(string $file, array $vars = []): void { echo self::renderRaw($file, $vars); } public static function set($arrayOrKey, $value = null): void { if(is_string($arrayOrKey)) { self::$vars[$arrayOrKey] = $value; } elseif(is_array($arrayOrKey)) { self::$vars = array_merge(self::$vars, $arrayOrKey); } else { throw new InvalidArgumentException('First parameter must be of type array or string.'); } } }