/** * 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; }
/** * {@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); }
/** * {@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); } }
/** * {@inheritDoc} */ public function has($pathOrUuid) { $path = $this->convertToPath($pathOrUuid); $this->guardInUploadPath($path); if ($path === false) { return false; } return $this->adapter->has($path); }
/** * {@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; }
/** * {@inheritdoc} */ public function has($path) { return $this->adapter->has($this->getPath($path)); }
/** * {@inheritdoc} */ public function has($path) { $path = Util::normalizePath($path); return (bool) $this->adapter->has($path); }
function it_checks_if_file_exists(AdapterInterface $adapter) { $adapter->has('filename')->willReturn(true); $this->exists('filename')->shouldReturn(true); }
/** * {@inheritdoc} */ public function has($path) { return $this->source->has($path); }
/** * {@inheritdoc} */ public function has(string $path) : bool { return $this->driver->has($path); }
/** * {@inheritdoc} */ public function exists($key) { return $this->adapter->has($key); }