/** * {@inheritDoc} */ public function createFile($key, Filesystem $filesystem) { $file = new File($key, $filesystem); if (!array_key_exists($key, $this->fileData)) { $directory = dirname($key) == '.' ? '' : dirname($key); $this->listDirectory($directory); } $fileData = $this->fileData[$key]; $file->setName($fileData['name']); $file->setSize($fileData['size']); return $file; }
/** * {@inheritdoc} */ public function createFile($key, Filesystem $filesystem) { $this->ensureDirectoryExists($this->directory, $this->create); $file = new File($key, $filesystem); if (!array_key_exists($key, $this->fileData)) { $dirname = \Gaufrette\Util\Path::dirname($key); $directory = $dirname == '.' ? '' : $dirname; $this->listDirectory($directory); } if (isset($this->fileData[$key])) { $fileData = $this->fileData[$key]; $file->setName($fileData['name']); $file->setSize($fileData['size']); } return $file; }
/** * {@inheritDoc} */ public function createFile($key, Filesystem $filesystem) { if (!$this->exists($key)) { throw new \RuntimeException(sprintf('The \'%s\' file does not exist.', $key)); } $file = new File($key, $filesystem); if (!array_key_exists($key, $this->fileData)) { $directory = dirname($key) == '.' ? '' : dirname($key); $this->listDirectory($directory); } $fileData = $this->fileData[$key]; $created = new \DateTime(); $created->setTimestamp($fileData['time']); $file->setName($fileData['name']); $file->setCreated($created); $file->setSize($fileData['size']); return $file; }