PluginProbe ʕ •ᴥ•ʔ
Transferito: WP Migration / trunk
Transferito: WP Migration vtrunk
trunk 11.4.0 12.0.0 13.1.0 14.0.0 14.0.11 14.0.7 14.1.0 14.1.1 14.1.2 14.1.3 14.1.4
transferito / vendor / aws / aws-sdk-php / src / S3 / PutObjectUrlMiddleware.php
transferito / vendor / aws / aws-sdk-php / src / S3 Last commit date
Crypto 11 months ago Exception 11 months ago RegionalEndpoint 11 months ago UseArnRegion 11 months ago AmbiguousSuccessParser.php 11 months ago ApplyChecksumMiddleware.php 11 months ago BatchDelete.php 11 months ago BucketEndpointArnMiddleware.php 11 months ago BucketEndpointMiddleware.php 11 months ago CalculatesChecksumTrait.php 11 months ago EndpointRegionHelperTrait.php 11 months ago GetBucketLocationParser.php 11 months ago MultipartCopy.php 11 months ago MultipartUploader.php 11 months ago MultipartUploadingTrait.php 11 months ago ObjectCopier.php 11 months ago ObjectUploader.php 11 months ago PermanentRedirectMiddleware.php 11 months ago PostObject.php 11 months ago PostObjectV4.php 11 months ago PutObjectUrlMiddleware.php 11 months ago RetryableMalformedResponseParser.php 11 months ago S3Client.php 11 months ago S3ClientInterface.php 11 months ago S3ClientTrait.php 11 months ago S3EndpointMiddleware.php 11 months ago S3MultiRegionClient.php 11 months ago S3UriParser.php 11 months ago SSECMiddleware.php 11 months ago StreamWrapper.php 11 months ago Transfer.php 11 months ago ValidateResponseChecksumParser.php 11 months ago
PutObjectUrlMiddleware.php
60 lines
1 <?php
2 namespace Aws\S3;
3
4 use Aws\CommandInterface;
5 use Aws\ResultInterface;
6 use Psr\Http\Message\RequestInterface;
7
8 /**
9 * Injects ObjectURL into the result of the PutObject operation.
10 *
11 * @internal
12 */
13 class PutObjectUrlMiddleware
14 {
15 /** @var callable */
16 private $nextHandler;
17
18 /**
19 * Create a middleware wrapper function.
20 *
21 * @return callable
22 */
23 public static function wrap()
24 {
25 return function (callable $handler) {
26 return new self($handler);
27 };
28 }
29
30 /**
31 * @param callable $nextHandler Next handler to invoke.
32 */
33 public function __construct(callable $nextHandler)
34 {
35 $this->nextHandler = $nextHandler;
36 }
37
38 public function __invoke(CommandInterface $command, RequestInterface $request = null)
39 {
40 $next = $this->nextHandler;
41 return $next($command, $request)->then(
42 function (ResultInterface $result) use ($command) {
43 $name = $command->getName();
44 switch ($name) {
45 case 'PutObject':
46 case 'CopyObject':
47 $result['ObjectURL'] = isset($result['@metadata']['effectiveUri'])
48 ? $result['@metadata']['effectiveUri']
49 : null;
50 break;
51 case 'CompleteMultipartUpload':
52 $result['ObjectURL'] = $result['Location'];
53 break;
54 }
55 return $result;
56 }
57 );
58 }
59 }
60