public function init()
    {
        $cachePath = $this->initCachePath();

        // @codeCoverageIgnoreStart
        if (!empty($cachePath) && !is_readable($cachePath)) {
            throw new Exception(Yii::t('app', 'Pug cache path is not readable.'));
        }

        if (!empty($cachePath) && !is_writable($cachePath)) {
            throw new Exception(Yii::t('app', 'Pug cache path is not writable.'));
        }
        // @codeCoverageIgnoreEnd

        $className = empty($this->renderer) ? 'Pug\\Pug' : $this->renderer;
        $baseDir = realpath(Yii::getAlias($this->viewPath));
        $this->pug = new $className(array_merge([
            'cache'      => $cachePath, // pug-php 2
            'cache_dir'  => $cachePath, // phug / pug-php 3
            'cache_path' => $cachePath, // tale-pug
            'basedir'    => $baseDir,   // pug-php 2
            'paths'      => [$baseDir], // phug / pug-php 3
        ], $this->options));

        $this->initFilters();
    }