Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function read(string $path) : string
 {
     if (!$this->has($path)) {
         throw new FileNotFoundException($path);
     }
     $content = $this->driver->read($path);
     return !$content ?: $content['contents'];
 }
Пример #2
0
 /**
  * {@inheritDoc}
  */
 public function readStream($pathOrUuid)
 {
     $path = $this->convertToPath($pathOrUuid);
     $this->guardNoInvalidUuid($pathOrUuid, $path);
     $this->guardInUploadPath($path);
     return $this->adapter->read($path);
 }
Пример #3
0
 /**
  * Read a file.
  *
  * @param string $path path to file
  *
  * @throws FileNotFoundException
  *
  * @return string|false file contents or FALSE when fails
  *                      to read existing file
  */
 public function read($path)
 {
     $path = Util::normalizePath($path);
     $this->assertPresent($path);
     if (!($object = $this->adapter->read($path))) {
         return false;
     }
     return $object['contents'];
 }
 /**
  * {@inheritdoc}
  */
 public function read($path)
 {
     $result = $this->mainAdapter->read($path);
     if (false !== $result) {
         return $result;
     }
     $result = $this->fallback->read($path);
     if (false !== $result && $this->forceCopyOnMain) {
         $this->mainAdapter->write($path, $result['contents'], new Config());
     }
     return $result;
 }
Пример #5
0
 /**
  * Read a file.
  *
  * @param string $path path to file
  *
  * @throws FileNotFoundException
  *
  * @return string|false file contents or FALSE when fails
  *                      to read existing file
  */
 public function read($path)
 {
     $path = Util::normalizePath($path);
     $this->assertPresent($path);
     if ($contents = $this->cache->read($path)) {
         return $contents;
     }
     if (!($object = $this->adapter->read($path))) {
         return false;
     }
     $this->cache->updateObject($path, $object, true);
     return $object['contents'];
 }
Пример #6
0
 /**
  * {@inheritdoc}
  */
 public function read($path)
 {
     return $this->adapter->read($this->getPath($path));
 }
Пример #7
0
 function it_reads_file(AdapterInterface $adapter)
 {
     $adapter->read('filename')->willReturn(['contents' => 'Hello.']);
     $this->read('filename')->shouldReturn('Hello.');
 }
Пример #8
0
 /**
  * {@inheritdoc}
  */
 public function read($path)
 {
     return $this->source->read($path);
 }
Пример #9
0
 /**
  * {@inheritdoc}
  */
 public function load()
 {
     if (($file = $this->adapter->read($this->file)) !== null) {
         $this->setFromStorage($file['contents']);
     }
 }
Пример #10
0
 /**
  * {@inheritdoc}
  */
 public function read($key)
 {
     return $this->adapter->read($key)['contents'];
 }