src/Pagic/Template.php
public function render($context = [])
    {
        $this->mergeGlobals($context);

        unset($context['this']);

        $obLevel = ob_get_level();
        ob_start();

        extract($context);

        // We'll evaluate the contents of the view inside a try/catch block so we can
        // flush out any stray output that might get out before an error occurs or
        // an exception is thrown. This prevents any partial views from leaking.
        try {
            $filePath = $this->path;
            include $filePath;
        }
        catch (Exception $e) {
            $this->handleException($e, $obLevel);
        }
        catch (Throwable $e) {
            $this->handleException(new FatalThrowableError($e), $obLevel);
        }

        return ob_get_clean();
    }
public function render($context = [])
    {
        $this->mergeGlobals($context);

        unset($context['this']);

        $obLevel = ob_get_level();
        ob_start();

        extract($context);

        // We'll evaluate the contents of the view inside a try/catch block so we can
        // flush out any stray output that might get out before an error occurs or
        // an exception is thrown. This prevents any partial views from leaking.
        try {
            $filePath = $this->path;
            include $filePath;
        }
        catch (Exception $e) {
            $this->handleException($e, $obLevel);
        }
        catch (Throwable $e) {
            $this->handleException(new FatalThrowableError($e), $obLevel);
        }

        return ob_get_clean();
    }
Renders the template.

@param array $context An array of parameters to pass to the template

@return string The rendered template
@throws \Exception
@throws \Throwable