exists($distPath . DS . 'debugbar.min.js') && $fs->exists($distPath . DS . 'debugbar.min.css')) { $this->error('The debug ber already installed'); return; } $this->copyResources($fs, $this->vendorDebugBarFolderPath, $publicDebugBarFolderPath); $this->info('Debugbar resources successfully published'); } /** * Recursively copies the debug bar assets * @throws FileSystemException */ private function copyResources(FileSystem $fs, string $src, string $dst): void { if (!$fs->isDirectory($src)) { throw FileSystemException::directoryNotExists($src); } if (!$fs->isDirectory($dst) && !mkdir($dst, 0777, true)) { throw FileSystemException::directoryNotWritable($dst); } $dir = opendir($src); if (is_resource($dir)) { while (($file = readdir($dir))) { if (($file !== '.') && ($file !== '..')) { if ($fs->isDirectory($src . DS . $file)) { $this->copyResources($fs, $src . DS . $file, $dst . DS . $file); } else { if (!$fs->copy($src . DS . $file, $dst . DS . $file)) { closedir($dir); throw FileSystemException::directoryNotWritable($dst); } } } } closedir($dir); } } }