Code Duplication    Length = 6-7 lines in 2 locations

PHPDaemon/Clients/DNS/Pool.php 2 locations

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