/** * @param $source * @param $path * @param $target * @return array */ protected function resolvePath($source, $path, $target) { if (!$this->filesystem->exists($source . DIRECTORY_SEPARATOR . $path)) { return array(); } return array($path => $target); }
/** * @param $source * @param $target */ protected function mirror($source, $target) { $isDir = $this->filesystem->isDir($source); $targetDir = $isDir ? $target : dirname($target); if (!$this->filesystem->exists($targetDir)) { $this->filesystem->mkdir($targetDir); } if ($isDir) { $this->filesystem->mirror($source, $target); } else { $this->filesystem->copy($source, $target); } }
/** * @param $sourceDir * @throws PackageSourceException */ protected function checkSourceExists($sourceDir) { if (!$this->filesystem->exists($sourceDir)) { throw new PackageSourceException(sprintf("Source directory %s does not exist", $sourceDir)); } }