<?php

namespace Soft_Tehnica\Freya_Sync_Service\STUtils;

use Jenssegers\Blade\Blade;

class STView
{
    /**
     * @param string $view
     * @param array<string, mixed> $params
     * 
     * @return string
     */
    public static function render(string $view, $params = []): string
    {
        $blade = new Blade(sprintf("%s/views", fsRootPath), sprintf("%s/cache", fsRootPath));
        try {
            return $blade->render($view, $params);
        } catch (\Throwable $exception) {
            dd($exception);
            return $exception->getMessage() . ' - ' . $exception->getFile() . ' - ' . $exception->getLine();
        }
    }
}
