private function readBuffer($template)
    {
        try {
            mb_internal_encoding('UTF-8');

            $this->assignDefaults();

            $this->incrementRendering();

            $obLevel = ob_get_level();

            ob_start();
            
            extract($this->shared + $this->vars, EXTR_OVERWRITE);

            include($template);

            $contents = ob_get_clean();
        } catch (Exception $e) {
            $this->handleViewException($e, $obLevel);
        } catch (Throwable $e) {
            $this->handleViewException(new FatalThrowableError($e), $obLevel);
        }

        $this->decrementRendering();

        $contents = ltrim($contents);

        return $this->getConfig('compress') != false
            ? $this->compressBuffer($contents)
            : $contents;
    }