src/S3/S3Client.php
private function getLocationConstraintMiddleware()
    {
        $region = $this->getRegion();
        return static function (callable $handler) use ($region) {
            return function (Command $command, $request = null) use ($handler, $region) {
                if ($command->getName() === 'CreateBucket') {
                    $locationConstraint = isset($command['CreateBucketConfiguration']['LocationConstraint'])
                        ? $command['CreateBucketConfiguration']['LocationConstraint']
                        : null;

                    if ($locationConstraint === 'us-east-1') {
                        unset($command['CreateBucketConfiguration']);
                    } elseif ('us-east-1' !== $region && empty($locationConstraint)) {
                        $command['CreateBucketConfiguration'] = ['LocationConstraint' => $region];
                    }
                }

                return $handler($command, $request);
            };
        };
    }
private function getLocationConstraintMiddleware()
    {
        $region = $this->getRegion();
        return static function (callable $handler) use ($region) {
            return function (Command $command, $request = null) use ($handler, $region) {
                if ($command->getName() === 'CreateBucket') {
                    $locationConstraint = isset($command['CreateBucketConfiguration']['LocationConstraint'])
                        ? $command['CreateBucketConfiguration']['LocationConstraint']
                        : null;

                    if ($locationConstraint === 'us-east-1') {
                        unset($command['CreateBucketConfiguration']);
                    } elseif ('us-east-1' !== $region && empty($locationConstraint)) {
                        $command['CreateBucketConfiguration'] = ['LocationConstraint' => $region];
                    }
                }

                return $handler($command, $request);
            };
        };
    }
private function getLocationConstraintMiddleware ( ) { $ region = $ this -> getRegion ( ) ; return static function ( callable $ handler ) use ( $ region ) { return function ( Command $ command , $ request = null ) use ( $ handler , $ region ) { if ( $ command -> getName ( ) === 'CreateBucket' ) { $ locationConstraint = isset ( $ command [ 'CreateBucketConfiguration' ] [ 'LocationConstraint' ] ) ? $ command [ 'CreateBucketConfiguration' ] [ 'LocationConstraint' ] : null ; if ( $ locationConstraint === 'us-east-1' ) { unset ( $ command [ 'CreateBucketConfiguration' ] ) ; } elseif ( 'us-east-1' !== $ region && empty ( $ locationConstraint ) ) { $ command [ 'CreateBucketConfiguration' ] = [ 'LocationConstraint' => $ region ] ; } } return $ handler ( $ command , $ request ) ; } ; } ; }
Provides a middleware that removes the need to specify LocationConstraint on CreateBucket.

@return \Closure
Provides a middleware that removes the need to specify LocationConstraint on CreateBucket .