Wallmander\ElasticsearchIndexer\Model\Config::getHosts PHP Method

getHosts() public static method

public static getHosts ( )
    public static function getHosts()
    {
        $hosts = [];
        // hosts separated by comma (,) is deprecated.
        $option = str_replace(',', "\n", static::option('hosts'));
        foreach (explode("\n", $option) as $h) {
            if (strpos($h, '://') === false) {
                $hosts[] = trim('http://' . $h);
            } else {
                $hosts[] = trim($h);
            }
        }
        return $hosts;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * Admin Settings Page.
  */
 public static function getSettings()
 {
     $hostsStatus = [];
     foreach (Config::getHosts() as $host) {
         $hostsStatus[] = Elasticsearch::ping($host);
     }
     require ESI_PATH . '/views/admin/settings.php';
 }
All Usage Examples Of Wallmander\ElasticsearchIndexer\Model\Config::getHosts