/** * @inheritdoc * @throws \RuntimeException */ public function download($id, FileInterface $output) { $source = new GFile($id, $this->filesystem); ErrorHandler::start(); $flag = file_put_contents($output->getPath(), $source->getContent()); ErrorHandler::stop(true); if ($flag === false) { throw new \RuntimeException("Could not download file ({$id})"); } }
/** * @inheritdoc * @throws \RuntimeException if copy operation is unsuccessful */ public function download($id, FileInterface $output) { $source = $this->getFilepath($id); ErrorHandler::start(); $flag = copy($source, $output->getPath()); ErrorHandler::stop(true); if (!$flag) { throw new \RuntimeException("Could not copy file ({$source})"); } }