Code Duplication    Length = 6-7 lines in 2 locations

PHPDaemon/Clients/DNS/Pool.php 2 locations

@@ 160-166 (lines=7) @@
157
     */
158
    public function resolve($hostname, $cb, $noncache = false, $nameServers = false)
159
    {
160
        if (!$this->preloading->hasCompleted()) {
161
            $pool = $this;
162
            $this->preloading->addListener(function ($job) use ($hostname, $cb, $noncache, $pool, $nameServers) {
163
                $pool->resolve($hostname, $cb, $noncache, $nameServers);
164
            });
165
            return;
166
        }
167
        $hostname = rtrim($hostname, '.') . '.';
168
        if (isset($this->hosts[$hostname])) {
169
            $cb($this->hosts[$hostname]);
@@ 239-244 (lines=6) @@
236
        if(!$nameServers){
237
            $nameServers = $this->nameServers;
238
        }
239
        if (!$this->preloading->hasCompleted()) {
240
            $this->preloading->addListener(function ($job) use ($hostname, $cb, $noncache, $pool, $nameServers, $proto) {
241
                $pool->get($hostname, $cb, $noncache, $nameServers, $proto);
242
            });
243
            return;
244
        }
245
        $nameServer = reset ($nameServers);
246
        $isIpv6 = filter_var($nameServer, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
247
        if($isIpv6){