$data */ public static function render(string $path, array $data = []): void { $contents = self::compile($path, $data); $existing = Termwind::getRenderer(); renderUsing(self::$output); try { render($contents); } finally { renderUsing($existing); } } /** * Compiles the given view. * * @param array $data */ private static function compile(string $path, array $data): string { extract($data); ob_start(); $path = str_replace('.', '/', $path); include sprintf('%s/../../resources/views/%s.php', __DIR__, $path); $contents = ob_get_contents(); ob_clean(); return (string) $contents; } }