GetPresignedUrlCommandHandler::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
namespace diecoding\aws\s3\handlers;
4
5
use diecoding\aws\s3\base\handlers\Handler;
6
use diecoding\aws\s3\commands\GetPresignedUrlCommand;
7
8
/**
9
 * Class GetPresignedUrlCommandHandler
10
 *
11
 * @package diecoding\aws\s3\handlers
12
 */
13
final class GetPresignedUrlCommandHandler extends Handler
14
{
15
    /**
16
     * @param \diecoding\aws\s3\commands\GetPresignedUrlCommand $command
17
     *
18
     * @return string
19
     */
20
    public function handle(GetPresignedUrlCommand $command): string
21
    {
22
        $awsCommand = $this->s3Client->getCommand('GetObject', $command->getArgs());
23
        $request = $this->s3Client->createPresignedRequest($awsCommand, $command->getExpiration());
24
25
        return (string)$request->getUri();
26
    }
27
}
28