protected function read($file, $type = 'raw', array $data = [])
    {
        $type = strtolower($type);

        if ($type === 'include' || $type === 'require') {
            ob_start();

            extract($data);
            unset($data);

            if ($type === 'include') {
                include $file;
            } else {
                require $file;
            }

            return ob_get_clean();
        }

        $raw = is_readable($file) === true ? file_get_contents($file) : $file;

        if ($type === 'base64') {
            return base64_encode($raw);
        }

        return $raw;
    }