1
0
This repository has been archived on 2026-04-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
yii2-aws-s3/src/handlers/GetPresignedUrlCommandHandler.php
2016-10-08 00:17:22 +06:00

28 lines
751 B
PHP

<?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->getExpiration());
return (string)$request->getUri();
}
}