Пример #1
0
 /**
  * Check whether a path exists
  *
  * @param  string  $path path to check
  * @return boolean whether the path exists
  */
 public function has($path)
 {
     $path = Util::normalizePath($path);
     if (($exists = $this->cache->has($path)) !== null) {
         return $exists;
     }
     $result = $this->adapter->has($path);
     if (!$result) {
         $this->cache->storeMiss($path);
         return false;
     }
     if (!is_array($result)) {
         $result = array();
     }
     $this->cache->updateObject($path, $result, true);
     return true;
 }
Пример #2
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);
     }
 }