From 73d0b329e9954ff408bde73fc275f384438f4109 Mon Sep 17 00:00:00 2001 From: Lenny ROUANET Date: Thu, 15 Sep 2022 17:34:16 +0200 Subject: [PATCH] Fixes File Zip --- component/File.php | 4 ++-- component/Zip.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/component/File.php b/component/File.php index 31e7ddc..fc5f6cd 100644 --- a/component/File.php +++ b/component/File.php @@ -55,7 +55,7 @@ public static function cleanFilename(string $fileName): string return $fileName . '.' . $extension; } - public static function download(string $distantPath, ?string $localPath = null): string + public static function download(string $distantPath, ?string $localPath = null): self { if (!$localPath) { $localPath = self::getTemoraryDirectory() . date('Y-m-d_H-i-s') . '-' . self::cleanFilename($distantPath); @@ -63,6 +63,6 @@ public static function download(string $distantPath, ?string $localPath = null): file_put_contents($localPath, fopen($distantPath, 'r')); - return $localPath; + return new self($localPath); } } diff --git a/component/Zip.php b/component/Zip.php index e9fe4f6..9bc061d 100644 --- a/component/Zip.php +++ b/component/Zip.php @@ -9,7 +9,7 @@ class Zip extends File { public function unarchive(?string $unarchiveDirectory = null): array { - if ($unarchiveDirectory) { + if (is_null($unarchiveDirectory)) { $unarchiveDirectory = self::getTemoraryDirectory() . pathinfo($this->path, PATHINFO_FILENAME) . '/'; }