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}")); } } } }
/** * Test if the VHost has successfully been initialized. * * @return void */ public function testConstructor() { $vhost = new Vhost($name = 'foo.bar', $appBase = '/foo.bar', $aliases = array('www.foo.bar', 'test.foo.bar')); $this->assertSame($name, $vhost->getName()); $this->assertSame($appBase, $vhost->getAppBase()); $this->assertSame($aliases, $vhost->getAliases()); }