private function preventCryptoSocketConflict(Vhost $new) { foreach ($this->vhosts as $old) { // If both hosts are encrypted there is no conflict if ($new->IsEncrypted() && $old->isEncrypted()) { continue; } if ($new->matchesAddress($old->getAddress()) && $old->getPort() == $new->getPort()) { throw new \LogicException(sprintf("Cannot register encrypted host `%s`; unencrypted " . "host `%s` registered on conflicting port `%s`", $new->IsEncrypted() ? $new->getId() : $old->getId(), $new->IsEncrypted() ? $old->getId() : $new->getId(), $new->getAddress() . ":" . $new->getPort())); } } }
private function preventCryptoSocketConflict(Vhost $new) { foreach ($this->vhosts as $old) { // If both hosts are encrypted or both unencrypted there is no conflict if ($new->isEncrypted() == $old->isEncrypted()) { continue; } foreach ($old->getInterfaces() as list($address, $port)) { if (in_array($port, $new->getPorts($address))) { throw new \LogicException(sprintf("Cannot register encrypted host `%s`; unencrypted " . "host `%s` registered on conflicting port `%s`", $new->IsEncrypted() ? $new->getName() : $old->getName() ?: "*", $new->IsEncrypted() ? $old->getName() : $new->getName() ?: "*", "{$address}:{$port}")); } } } }