You are here

protected static function StreamWrapperConfiguration::getS3Domain in AmazonS3 7.2

Get the S3 domain for a bucket.

Parameters

string $bucket: The bucket to get the domain for.

Return value

string The S3 domain, such as bucket.s3.amazonaws.com.

2 calls to StreamWrapperConfiguration::getS3Domain()
StreamWrapperConfiguration::fromConfig in src/StreamWrapperConfiguration.php
Generate a configuration object from an array.
StreamWrapperConfiguration::fromDrupalVariables in src/StreamWrapperConfiguration.php
Set the stream wrapper configuration using Drupal variables.

File

src/StreamWrapperConfiguration.php, line 113

Class

StreamWrapperConfiguration
Class to manage S3 stream wrapper configuration.

Namespace

Drupal\amazons3

Code

protected static function getS3Domain($bucket) {
  $domain = StreamWrapper::S3_API_DOMAIN;

  // If the bucket does not contain dots, the S3 SDK generates URLs that
  // use the bucket name in the host.
  if (strpos($bucket, '.') === FALSE) {
    $domain = $bucket . '.' . $domain;
  }
  return $domain;
}