private function publishPublicFolder($register)
    {
        // read files
        $publicPath = $this->path . '/public';
        if (!file_exists($publicPath)) {
            return;
        }
        $files = [];
        list_files($files, $publicPath);

        // copy files
        $publicPathLength = strlen($publicPath) + 1;
        foreach ($files as $file) {
            $destDir = public_path(substr(dirname($file), $publicPathLength));
            if (!file_exists($destDir)) {
                if (!make_dir($destDir, 0755)) {
                    throw new RuntimeException('Unable to create directory ' . $destDir); //@codeCoverageIgnore
                }
            } //@codeCoverageIgnore
            $dest = $destDir . DIRECTORY_SEPARATOR . basename($file);
            if ($register) {
                copy($file, $dest);
            }
            else {
                if (file_exists($dest)) {
                    unlink($dest);
                }
            }
        }
    }