public function Cluster::getSafeUrl in Elasticsearch Connector 8.2
Same name and namespace in other branches
- 8.7 src/Entity/Cluster.php \Drupal\elasticsearch_connector\Entity\Cluster::getSafeUrl()
- 8.5 src/Entity/Cluster.php \Drupal\elasticsearch_connector\Entity\Cluster::getSafeUrl()
- 8.6 src/Entity/Cluster.php \Drupal\elasticsearch_connector\Entity\Cluster::getSafeUrl()
Get the full base URL of the cluster, including any authentication.
Return value
string
File
- src/
Entity/ Cluster.php, line 159 - Contains \Drupal\elasticsearch_connector\Entity\Cluster.
Class
- Cluster
- Defines the Elasticsearch Connector Cluster configuration entity.
Namespace
Drupal\elasticsearch_connector\EntityCode
public function getSafeUrl() {
$options = $this->options;
$url_parsed = parse_url($this->url);
if ($options['use_authentication']) {
return $url_parsed['scheme'] . '://' . $options['username'] . ':****@' . $url_parsed['host'] . (isset($url_parsed['port']) ? ':' . $url_parsed['port'] : '');
}
else {
return $url_parsed['scheme'] . '://' . (isset($url_parsed['user']) ? $url_parsed['user'] . ':****@' : '') . $url_parsed['host'] . (isset($url_parsed['port']) ? ':' . $url_parsed['port'] : '');
}
}