You are here

protected function ContentHubRequirementBase::getDomain in Acquia Content Hub 8

Get the domain to run the tests on.

2 calls to ContentHubRequirementBase::getDomain()
EndpointAccessibilityRequirement::verify in acquia_contenthub_diagnostic/src/Plugin/ContentHubRequirement/EndpointAccessibilityRequirement.php
Verify the accessibility of the content hub endpoints.
InvalidCertificatesRequirement::verify in acquia_contenthub_diagnostic/src/Plugin/ContentHubRequirement/InvalidCertificatesRequirement.php
Verify SSL certificates.

File

acquia_contenthub_diagnostic/src/ContentHubRequirementBase.php, line 140

Class

ContentHubRequirementBase
Defines a base implementation that Content Hub Requirements will extend.

Namespace

Drupal\acquia_contenthub_diagnostic

Code

protected function getDomain() {
  global $base_url;
  $domain = $_SERVER['SERVER_NAME'] ?: parse_url($base_url, PHP_URL_HOST);
  if (empty($domain)) {
    $error = "Your site's domain could not be determined.";
    if (PHP_SAPI === 'cli') {
      $error .= ' ' . 'Use a valid Drush site alias or visit the Status report in a browser.';
    }
    throw new \Exception($error);
  }
  return 'https://' . $domain;
}