public function __invoke()

in src/View/Helper/S3Link.php [66:84]


    public function __invoke($object, $bucket = '', $expiration = '')
    {
        $bucket = trim($bucket ?: $this->getDefaultBucket(), '/');

        if (empty($bucket)) {
            throw new InvalidDomainNameException('An empty bucket name was given');
        }

        if ($expiration) {
            $command = $this->client->getCommand('GetObject', [
                'Bucket' => $bucket,
                'Key'    => $object
            ]);

            return $this->client->createPresignedRequest($command, $expiration)->getUri()->__toString();
        } else {
            return $this->client->getObjectUrl($bucket, $object);
        }
    }