public function AcsfConfig::__construct in Acquia Cloud Site Factory Connector 8.2
Same name and namespace in other branches
- 8 src/AcsfConfig.php \Drupal\acsf\AcsfConfig::__construct()
Constructor.
Parameters
string $ah_site: (Optional) Acquia Hosting sitegroup.
string $ah_env: (Optional) Acquia Hosting environment.
Throws
File
- src/
AcsfConfig.php, line 69
Class
- AcsfConfig
- Provides an interface to define how our message configuration should work.
Namespace
Drupal\acsfCode
public function __construct($ah_site = NULL, $ah_env = NULL) {
if (function_exists('is_acquia_host') && !is_acquia_host()) {
return;
}
// If none specified, pick the site group and environment from $_ENV.
if (empty($ah_site)) {
$ah_site = $_ENV['AH_SITE_GROUP'];
}
if (empty($ah_env)) {
$ah_env = $_ENV['AH_SITE_ENVIRONMENT'];
}
$this->ahSite = $ah_site;
$this->ahEnv = $ah_env;
$this
->loadConfig();
// Require the loadConfig implementation to set required values.
foreach ([
'url',
'username',
'password',
] as $key) {
if (empty($this->{$key})) {
throw new AcsfConfigIncompleteException(sprintf('The ACSF configuration was incomplete, no value was found for %s.', $key));
}
}
}