Skip to content

Commit

Permalink
Merge pull request #3 from PhantPHP/Fixes
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
lennyrouanet authored Sep 15, 2022
2 parents b2d179f + 73d0b32 commit 6811d2d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions component/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ 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);
}

file_put_contents($localPath, fopen($distantPath, 'r'));

return $localPath;
return new self($localPath);
}
}
2 changes: 1 addition & 1 deletion component/Zip.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) . '/';
}

Expand Down

0 comments on commit 6811d2d

Please sign in to comment.