diff options
Diffstat (limited to 'apps/files_external/lib/Lib/Storage/StreamWrapper.php')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/StreamWrapper.php | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/apps/files_external/lib/Lib/Storage/StreamWrapper.php b/apps/files_external/lib/Lib/Storage/StreamWrapper.php index 2928c081505..1272b9d4d8a 100644 --- a/apps/files_external/lib/Lib/Storage/StreamWrapper.php +++ b/apps/files_external/lib/Lib/Storage/StreamWrapper.php @@ -1,4 +1,5 @@ <?php + /** * SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors * SPDX-FileCopyrightText: 2016 ownCloud, Inc. @@ -6,19 +7,17 @@ */ namespace OCA\Files_External\Lib\Storage; -abstract class StreamWrapper extends \OC\Files\Storage\Common { +use OC\Files\Storage\Common; + +abstract class StreamWrapper extends Common { - /** - * @param string $path - * @return string|null - */ - abstract public function constructUrl($path); + abstract public function constructUrl(string $path): ?string; - public function mkdir($path) { + public function mkdir(string $path): bool { return mkdir($this->constructUrl($path)); } - public function rmdir($path) { + public function rmdir(string $path): bool { if ($this->is_dir($path) && $this->isDeletable($path)) { $dh = $this->opendir($path); if (!is_resource($dh)) { @@ -40,19 +39,19 @@ abstract class StreamWrapper extends \OC\Files\Storage\Common { } } - public function opendir($path) { + public function opendir(string $path) { return opendir($this->constructUrl($path)); } - public function filetype($path) { + public function filetype(string $path): string|false { return @filetype($this->constructUrl($path)); } - public function file_exists($path) { + public function file_exists(string $path): bool { return file_exists($this->constructUrl($path)); } - public function unlink($path) { + public function unlink(string $path): bool { $url = $this->constructUrl($path); $success = unlink($url); // normally unlink() is supposed to do this implicitly, @@ -61,11 +60,11 @@ abstract class StreamWrapper extends \OC\Files\Storage\Common { return $success; } - public function fopen($path, $mode) { + public function fopen(string $path, string $mode) { return fopen($this->constructUrl($path), $mode); } - public function touch($path, $mtime = null) { + public function touch(string $path, ?int $mtime = null): bool { if ($this->file_exists($path)) { if (is_null($mtime)) { $fh = $this->fopen($path, 'a'); @@ -82,26 +81,19 @@ abstract class StreamWrapper extends \OC\Files\Storage\Common { } } - /** - * @param string $path - * @param string $target - */ - public function getFile($path, $target) { + public function getFile(string $path, string $target): bool { return copy($this->constructUrl($path), $target); } - /** - * @param string $target - */ - public function uploadFile($path, $target) { + public function uploadFile(string $path, string $target): bool { return copy($path, $this->constructUrl($target)); } - public function rename($source, $target) { + public function rename(string $source, string $target): bool { return rename($this->constructUrl($source), $this->constructUrl($target)); } - public function stat($path) { + public function stat(string $path): array|false { return stat($this->constructUrl($path)); } } |