![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/vendor/aws/aws-sdk-php/src/S3/Parser/ |
<?php namespace Aws\S3\Parser; use Aws\CommandInterface; use 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; } }