/** * {@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; }
/** * {@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)); }
/** * {@inheritdoc} */ public function progress(SourceInterface $source) { $state = $source->getState($this); if (!empty($state->fileLength)) { return (double) $state->pointer / $state->fileLength; } return ProgressInterface::COMPLETE; }
/** * {@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; }