Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function progress(SourceInterface $source)
 {
     $state = $source->getState($this);
     if (!empty($state->total)) {
         return (double) ($state->total - count($state->files)) / $state->total;
     }
     return ProgressInterface::COMPLETE;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function transport(SourceInterface $source)
 {
     $filename = $source->getSource();
     if (FileSystem::checkFile($filename)) {
         return new Stream(fopen($filename, 'r+'));
     }
     throw new \RuntimeException(sprintf('The file "%s" does not exist or is not readable.', $filename));
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function progress(SourceInterface $source)
 {
     $state = $source->getState($this);
     if (!empty($state->fileLength)) {
         return (double) $state->pointer / $state->fileLength;
     }
     return ProgressInterface::COMPLETE;
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function progress(SourceInterface $source)
 {
     $state = $source->getState($this);
     if (empty($state->total) || $state->pointer >= $state->total) {
         return ProgressInterface::COMPLETE;
     }
     return (double) $state->pointer / $state->total;
 }