private function writeToWebDir($file, $contents)
    {
        if (!$this->webDir) {
            return;
        }

        if (!is_writable($this->webDir)) {
            trigger_error(sprintf('Directory %s is not writeable', $this->webDir));

            return;
        }

        $destFile = $this->webDir . $file;
        $destDir  = dirname($destFile);

        if (!is_dir($destDir)) {
            mkdir($destDir, 0777, true);
        }

        file_put_contents($destFile, $contents);
    }