Submit
Path:
~
/
/
proc
/
self
/
root
/
opt
/
psa
/
admin
/
plib
/
modules
/
letsencrypt
/
vendor
/
aws
/
aws-sdk-php
/
src
/
S3
/
Parser
/
File Content:
GetBucketLocationResultMutator.php
<?php namespace PleskLetsEncrypt\Aws\S3\Parser; use PleskLetsEncrypt\Aws\CommandInterface; use PleskLetsEncrypt\Aws\ResultInterface; use Psr\Http\Message\ResponseInterface; /** * A custom mutator for a GetBucketLocation request, which * extract the bucket location value and injects it into the * result as the `LocationConstraint` field. * * @internal */ final class GetBucketLocationResultMutator implements S3ResultMutator { /** * @inheritDoc */ public function __invoke(ResultInterface $result, CommandInterface $command, ResponseInterface $response) : ResultInterface { if ($command->getName() !== 'GetBucketLocation') { return $result; } static $location = 'us-east-1'; static $pattern = '/>(.+?)<\\/LocationConstraint>/'; if (\preg_match($pattern, $response->getBody(), $matches)) { $location = $matches[1] === 'EU' ? 'eu-west-1' : $matches[1]; } $result['LocationConstraint'] = $location; $response->getBody()->rewind(); return $result; } }
Submit
FILE
FOLDER
INFO
Name
Size
Permission
Action
GetBucketLocationResultMutator.php
1079 bytes
0644
S3Parser.php
7753 bytes
0644
S3ResultMutator.php
1152 bytes
0644
ValidateResponseChecksumResultMutator.php
5556 bytes
0644
N4ST4R_ID | Naxtarrr