forked from LiveCarta/yii2-aws-s3
initial commit
This commit is contained in:
27
src/handlers/GetPresignedUrlCommandHandler.php
Normal file
27
src/handlers/GetPresignedUrlCommandHandler.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace frostealth\yii2\aws\s3\handlers;
|
||||
|
||||
use frostealth\yii2\aws\s3\base\handlers\Handler;
|
||||
use frostealth\yii2\aws\s3\commands\GetPresignedUrlCommand;
|
||||
|
||||
/**
|
||||
* Class GetPresignedUrlCommandHandler
|
||||
*
|
||||
* @package frostealth\yii2\aws\s3\handlers
|
||||
*/
|
||||
final class GetPresignedUrlCommandHandler extends Handler
|
||||
{
|
||||
/**
|
||||
* @param \frostealth\yii2\aws\s3\commands\GetPresignedUrlCommand $command
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function handle(GetPresignedUrlCommand $command): string
|
||||
{
|
||||
$awsCommand = $this->s3Client->getCommand('GetObject', $command->getArgs());
|
||||
$request = $this->s3Client->createPresignedRequest($awsCommand, $command->getExpires());
|
||||
|
||||
return (string)$request->getUri();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user