Phergie\Irc\Client\React\Client::getRemote PHP Method

getRemote() protected method

Derives a remote for a given connection.
protected getRemote ( Phergie\Irc\ConnectionInterface $connection ) : string
$connection Phergie\Irc\ConnectionInterface
return string Remote usable to establish a socket connection
    protected function getRemote(ConnectionInterface $connection)
    {
        $hostname = $connection->getServerHostname();
        $port = $connection->getServerPort();
        $deferred = new Deferred();
        $this->getResolver()->resolve($hostname)->then(function ($ip) use($deferred, $port) {
            $deferred->resolve('tcp://' . $ip . ':' . $port);
        }, function ($error) use($deferred) {
            $deferred->reject($error);
        });
        return $deferred->promise();
    }