Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function save()
 {
     $contents = $this->getForStorage();
     if ($this->adapter->has($this->file)) {
         $this->adapter->update($this->file, $contents);
     } else {
         $this->adapter->write($this->file, $contents);
     }
 }
Exemplo n.º 2
0
 /**
  * Write a file
  *
  * @param  string              $path     path to file
  * @param  string              $contents file contents
  * @param  mixed               $config
  * @throws FileExistsException
  * @return boolean             success boolean
  */
 public function write($path, $contents, $config = null)
 {
     $path = Util::normalizePath($path);
     $this->assertAbsent($path);
     $config = Util::ensureConfig($config);
     $config->setFallback($this->getConfig());
     if (!($object = $this->adapter->write($path, $contents, $config))) {
         return false;
     }
     $this->cache->updateObject($path, $object, true);
     $this->cache->ensureParentDirectories($path);
     return true;
 }