public function setBasePath($path)
    {
        if (!is_dir($path)) {
            throw new \Exception("Base path for views is not a directory: " . $path);
        }
        $this->path = rtrim($path, '/') . '/';
    }