Example #1
0
 /**
  * {@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;
 }