Aerys\VhostContainer::addHttpDriver PHP Method

addHttpDriver() private method

private addHttpDriver ( Vhost $vhost )
$vhost Vhost
    private function addHttpDriver(Vhost $vhost)
    {
        $driver = $vhost->getHttpDriver() ?? $this->defaultHttpDriver;
        foreach ($vhost->getInterfaces() as list($address, $port)) {
            $generic = $this->httpDrivers[$port][\strlen(inet_pton($address)) === 4 ? "0.0.0.0" : "::"] ?? $driver;
            if (($this->httpDrivers[$port][$address] ?? $generic) !== $driver) {
                throw new \LogicException("Cannot use two different HttpDriver instances on an equivalent address-port pair");
            }
            if ($address == "0.0.0.0" || $address == "::") {
                foreach ($this->httpDrivers[$port] ?? [] as $oldAddr => $oldDriver) {
                    if ($oldDriver !== $driver && (\strlen(inet_pton($address)) === 4) == ($address == "0.0.0.0")) {
                        throw new \LogicException("Cannot use two different HttpDriver instances on an equivalent address-port pair");
                    }
                }
            }
            $this->httpDrivers[$port][$address] = $driver;
        }
        $hash = spl_object_hash($driver);
        if ($this->setupArgs && $this->setupHttpDrivers[$hash] ?? false) {
            $driver->setup(...$this->setupArgs);
            $this->setupHttpDrivers[$hash] = true;
        }
    }