Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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