aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Storage/PolyFill/CopyDirectory.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Files/Storage/PolyFill/CopyDirectory.php')
-rw-r--r--lib/private/Files/Storage/PolyFill/CopyDirectory.php35
1 files changed, 9 insertions, 26 deletions
diff --git a/lib/private/Files/Storage/PolyFill/CopyDirectory.php b/lib/private/Files/Storage/PolyFill/CopyDirectory.php
index 4b3e367da78..2f6167ef85e 100644
--- a/lib/private/Files/Storage/PolyFill/CopyDirectory.php
+++ b/lib/private/Files/Storage/PolyFill/CopyDirectory.php
@@ -10,45 +10,32 @@ namespace OC\Files\Storage\PolyFill;
trait CopyDirectory {
/**
* Check if a path is a directory
- *
- * @param string $path
- * @return bool
*/
- abstract public function is_dir($path);
+ abstract public function is_dir(string $path): bool;
/**
* Check if a file or folder exists
- *
- * @param string $path
- * @return bool
*/
- abstract public function file_exists($path);
+ abstract public function file_exists(string $path): bool;
/**
* Delete a file or folder
- *
- * @param string $path
- * @return bool
*/
- abstract public function unlink($path);
+ abstract public function unlink(string $path): bool;
/**
* Open a directory handle for a folder
*
- * @param string $path
- * @return resource | bool
+ * @return resource|false
*/
- abstract public function opendir($path);
+ abstract public function opendir(string $path);
/**
* Create a new folder
- *
- * @param string $path
- * @return bool
*/
- abstract public function mkdir($path);
+ abstract public function mkdir(string $path): bool;
- public function copy($source, $target) {
+ public function copy(string $source, string $target): bool {
if ($this->is_dir($source)) {
if ($this->file_exists($target)) {
$this->unlink($target);
@@ -62,15 +49,11 @@ trait CopyDirectory {
/**
* For adapters that don't support copying folders natively
- *
- * @param $source
- * @param $target
- * @return bool
*/
- protected function copyRecursive($source, $target) {
+ protected function copyRecursive(string $source, string $target): bool {
$dh = $this->opendir($source);
$result = true;
- while ($file = readdir($dh)) {
+ while (($file = readdir($dh)) !== false) {
if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
if ($this->is_dir($source . '/' . $file)) {
$this->mkdir($target . '/' . $file);