Lines Matching refs:host
458 'host' => $this->parseElasticCloudId($cloudId),
765 foreach ($hosts as $host) {
766 if (is_string($host)) {
767 $host = $this->prependMissingScheme($host);
768 $host = $this->extractURIParts($host);
769 } elseif (is_array($host)) {
770 $host = $this->normalizeExtendedHost($host);
772 $this->logger->error("Could not parse host: ".print_r($host, true));
773 throw new RuntimeException("Could not parse host: ".print_r($host, true));
776 $connections[] = $this->connectionFactory->create($host);
785 private function normalizeExtendedHost(array $host): array
787 if (isset($host['host']) === false) {
788 $this->logger->error("Required 'host' was not defined in extended format: ".print_r($host, true));
789 throw new RuntimeException("Required 'host' was not defined in extended format: ".print_r($host, true));
792 if (isset($host['scheme']) === false) {
793 $host['scheme'] = 'http';
795 if (isset($host['port']) === false) {
796 $host['port'] = 9200;
798 return $host;
804 private function extractURIParts(string $host): array
806 $parts = parse_url($host);
809 throw new InvalidArgumentException(sprintf('Could not parse URI: "%s"', $host));
819 private function prependMissingScheme(string $host): string
821 if (!preg_match("/^https?:\/\//", $host)) {
822 $host = 'http://' . $host;
825 return $host;