示例#1
0
 /**
  * @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})");
     }
 }
示例#2
0
 /**
  * @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})");
     }
 }