예제 #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;
     }
     $this->cache->updateObject($path, $result === true ? array() : $result, true);
     return true;
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function has($path)
 {
     $path = Util::normalizePath($path);
     $exists = $this->cache->has($path);
     if (is_bool($exists)) {
         return $exists;
     }
     $result = $this->adapter->has($path);
     if (!$result) {
         $this->cache->storeMiss($path);
         return false;
     }
     $object = is_array($result) ? $result : compact('path');
     $this->cache->updateObject($path, $object, true);
     return true;
 }
 public function it_should_cache_has()
 {
     $this->cache->has($path = 'path.txt')->willReturn(null);
     $this->adapter->has($path)->willReturn(true);
     $this->cache->updateObject($path, compact('path'), true)->shouldBeCalled();
     $this->has($path)->shouldBe(true);
 }
 /**
  * {@inheritdoc}
  */
 public function getVisibility($path)
 {
     if ($this->mainAdapter->has($path)) {
         return $this->mainAdapter->getVisibility($path);
     }
     return $this->fallback->getVisibility($path);
 }
 /**
  * {@inheritDoc}
  */
 public function has($path)
 {
     $key = $this->getCacheKey($path);
     if ($this->cache->contains($key)) {
         return true;
     }
     return $this->adapter->has($path);
 }
예제 #6
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);
     }
 }
예제 #7
0
 /**
  * {@inheritDoc}
  */
 public function has($pathOrUuid)
 {
     $path = $this->convertToPath($pathOrUuid);
     $this->guardInUploadPath($path);
     if ($path === false) {
         return false;
     }
     return $this->adapter->has($path);
 }
예제 #8
0
 /**
  * {@inheritdoc}
  */
 public function has($path)
 {
     $cacheHas = $this->cache->has($path);
     if ($cacheHas !== null) {
         return $cacheHas;
     }
     $adapterResponse = $this->adapter->has($path);
     if (!$adapterResponse) {
         $this->cache->storeMiss($path);
     } else {
         $cacheEntry = is_array($adapterResponse) ? $adapterResponse : compact('path');
         $this->cache->updateObject($path, $cacheEntry, true);
     }
     return $adapterResponse;
 }
예제 #9
0
 /**
  * {@inheritdoc}
  */
 public function has($path)
 {
     return $this->adapter->has($this->getPath($path));
 }
예제 #10
0
 /**
  * {@inheritdoc}
  */
 public function has($path)
 {
     $path = Util::normalizePath($path);
     return (bool) $this->adapter->has($path);
 }
예제 #11
0
 function it_checks_if_file_exists(AdapterInterface $adapter)
 {
     $adapter->has('filename')->willReturn(true);
     $this->exists('filename')->shouldReturn(true);
 }
예제 #12
0
 /**
  * {@inheritdoc}
  */
 public function has($path)
 {
     return $this->source->has($path);
 }
예제 #13
0
 /**
  * {@inheritdoc}
  */
 public function has(string $path) : bool
 {
     return $this->driver->has($path);
 }
예제 #14
0
 /**
  * {@inheritdoc}
  */
 public function exists($key)
 {
     return $this->adapter->has($key);
 }