MCPcopy Create free account
hub / github.com/error311/FileRise / read

Method read

src/FileRise/Storage/WebDavAdapter.php:160–184  ·  view source on GitHub ↗
(string $path, ?int $length = null, int $offset = 0)

Source from the content-addressed store, hash-verified

158 }
159
160 public function read(string $path, ?int $length = null, int $offset = 0): string|false
161 {
162 $stream = $this->openReadStream($path, $length, $offset);
163 if ($stream === false) {
164 return false;
165 }
166
167 if (is_resource($stream)) {
168 $data = ($length !== null)
169 ? stream_get_contents($stream, $length)
170 : stream_get_contents($stream);
171 fclose($stream);
172 return ($data === false) ? false : $data;
173 }
174
175 if (is_object($stream) && method_exists($stream, 'read')) {
176 $data = $stream->read($length ?? 0);
177 if (method_exists($stream, 'close')) {
178 $stream->close();
179 }
180 return $data;
181 }
182
183 return false;
184 }
185
186 public function openReadStream(string $path, ?int $length = null, int $offset = 0)
187 {

Callers 13

readStreamChunkMethod · 0.45
downloadSharedFileMethod · 0.45
readStreamChunkMethod · 0.45
snippetMethod · 0.45
opReadFileMethod · 0.45
deleteFilesMethod · 0.45
getTrashItemsMethod · 0.45
restoreFilesMethod · 0.45
deleteTrashFilesMethod · 0.45

Calls 2

openReadStreamMethod · 0.95
closeMethod · 0.80

Tested by

no test coverage detected