public function testNotEquals() { $socket1 = new UnixSocket('/var/run/test.sock'); $socket2 = new NetworkSocket('127.0.0.1'); $socket2->setPort(8080); $this->assertFalse($socket1->equals($socket2)); $this->assertFalse($socket2->equals($socket1)); }
/** * @param array $server * * @return Socket */ private function convertServerToSocket(array $server) : Socket { if (!array_key_exists('type', $server)) { throw new RuntimeException('Cannot determine type of socket'); } if ($server['type'] == 'SOCKET') { $socket = new UnixSocket($server['host']); $socket->setFileName($server['host']); return $socket; } if ($server['type'] == 'TCP') { $socket = new NetworkSocket(); $socket->setHost($server['host']); $socket->setPort($server['port']); return $socket; } throw new RuntimeException('Cannot determine type of socket'); }