Skip to content

Commit

Permalink
Added mount manager temporaryUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
frankdejonge committed Oct 20, 2022
1 parent c566cb4 commit 876c806
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/MountManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace League\Flysystem;

use DateTimeInterface;
use Throwable;

use function method_exists;
Expand Down Expand Up @@ -263,6 +264,18 @@ public function publicUrl(string $path, array $config = []): string
return $filesystem->publicUrl($path, $config);
}

public function temporaryUrl(string $path, DateTimeInterface $expiresAt, array $config = []): string
{
/** @var FilesystemOperator $filesystem */
[$filesystem, $path] = $this->determineFilesystemAndPath($path);

if ( ! method_exists($filesystem, 'temporaryUrl')) {
throw new UnableToGenerateTemporaryUrl(sprintf('%s does not support generating public urls.', $filesystem::class), $path);
}

return $filesystem->temporaryUrl($path, $expiresAt, $config);
}

public function checksum(string $path, array $config = []): string
{
/** @var FilesystemOperator $filesystem */
Expand Down

0 comments on commit 876c806

Please sign in to comment.