public function it_should_forward_read_streams() { $path = 'path.txt'; $response = ['path' => $path]; $this->adapter->readStream($path)->willReturn($response); $this->readStream($path)->shouldbe($response); }
/** * Retrieves a read-stream for a path. * * @param string $path * * @return resource|false path resource or false when on failure */ public function readStream($path) { $path = Util::normalizePath($path); $this->assertPresent($path); if (!($object = $this->adapter->readStream($path))) { return false; } return $object['stream']; }
/** * Copies a resource accessible through the fallback adapter to the filesystem abstracted with the main adapter. * * @param $path * @return boolean */ private function portFromFallback($path, $newpath) { $buffer = $this->fallback->readStream($path); if (false === $buffer) { return false; } $result = $this->mainAdapter->writeStream($newpath, $buffer['stream'], new Config()); if (is_resource($buffer['stream'])) { fclose($buffer['stream']); } return false !== $result; }
/** * Retrieves a read-stream for a path. * * @param string $path * * @return resource|false path resource or false when on failure */ public function readStream($path) { $path = Util::normalizePath($path); $this->assertPresent($path); if ($stream = $this->cache->readStream($path)) { return $stream; } if (!($object = $this->adapter->readStream($path))) { return false; } $this->cache->updateObject($path, $object, true); return $object['stream']; }
/** * {@inheritdoc} */ public function readStream($path) { return $this->adapter->readStream($this->getPath($path)); }
/** * {@inheritdoc} */ public function readStream($path) { return $this->source->readStream($path); }