fileUtils->getNode($file); if ($node instanceof Folder) { $output->writeln("$file is a folder"); return ExitCode::Failure; } if (!$node && is_numeric($file)) { $output->writeln("$file not found"); return ExitCode::Failure; } $source = ($input === '-') ? STDIN : fopen($input, 'r'); if (!$source) { $output->writeln("Failed to open $input"); return ExitCode::Failure; } if ($node instanceof File) { $target = $node->fopen('w'); if (!$target) { $output->writeln("Failed to open $file"); return ExitCode::Failure; } stream_copy_to_stream($source, $target); } else { $parentPath = dirname($file); if (!$this->rootFolder->nodeExists($parentPath)) { $this->rootFolder->newFolder($parentPath); } $this->rootFolder->newFile($file, $source); } return ExitCode::Success; } }