/** * @inheritdoc */ public function run(ArrayAccess $paths) { $dest = $this->targetPath($paths); if (!$this->overwrite->should($dest)) { $this->io->comment(" - {$this->name} skipped."); return; } $this->actionSource[0] === 'download' ? $this->download($this->actionSource[1], $dest) : $this->copy($this->actionSource[1], $dest, $paths); }
/** * @param \WCM\WPStarter\Setup\Steps\StepInterface $step * @param \ArrayAccess $paths * @return bool */ private function shouldProcess(StepInterface $step, ArrayAccess $paths) { $comment = ''; $process = $step->allowed($this->config, $paths); if ($process && $step instanceof FileStepInterface) { /** @var \WCM\WPStarter\Setup\Steps\FileStepInterface $step */ $path = $step->targetPath($paths); $process = $this->overwrite->should($path); $comment = $process ? '' : '- ' . basename($path) . ' exists and will be preserved.'; } if ($process && $step instanceof OptionalStepInterface) { /** @var \WCM\WPStarter\Setup\Steps\OptionalStepInterface $step */ $process = $step->question($this->config, $this->io); $comment = $process ? '' : $step->skipped(); } $process or $this->io->comment($comment); return $process; }