Aerys\Vhost::__construct PHP Method

__construct() public method

public __construct ( string $name, array $interfaces, callable $application, array $filters, array $monitors = [], aerys\HttpDriver $driver = null )
$name string
$interfaces array
$application callable
$filters array
$monitors array
$driver aerys\HttpDriver
    public function __construct(string $name, array $interfaces, callable $application, array $filters, array $monitors = [], HttpDriver $driver = null)
    {
        $this->name = strtolower($name);
        if (!$interfaces) {
            throw new \InvalidArgumentException("At least one interface must be passed, an empty interfaces array is not allowed");
        }
        foreach ($interfaces as $interface) {
            $this->addInterface($interface);
        }
        $this->application = $application;
        $this->filters = array_values($filters);
        $this->monitors = $monitors;
        $this->httpDriver = $driver;
        if (self::hasAlpnSupport()) {
            $this->tlsDefaults["alpn_protocols"] = "h2";
        }
        if ($this->name !== '') {
            $addresses = [$this->name];
        } else {
            $addresses = array_unique(array_column($interfaces, 0));
        }
        $ports = array_unique(array_column($interfaces, 1));
        foreach ($addresses as $address) {
            if (strpos($address, ":") !== false) {
                $address = "[{$address}]";
            }
            foreach ($ports as $port) {
                $this->ids[] = "{$address}:{$port}";
            }
        }
    }