Code Duplication    Length = 10-12 lines in 2 locations

src/Address/IPv4.php 1 location

@@ 339-348 (lines=10) @@
336
     */
337
    public function getRangeType()
338
    {
339
        if ($this->rangeType === null) {
340
            $rangeType = null;
341
            foreach (static::getReservedRanges() as $reservedRange) {
342
                $rangeType = $reservedRange->getAddressType($this);
343
                if ($rangeType !== null) {
344
                    break;
345
                }
346
            }
347
            $this->rangeType = $rangeType === null ? static::getDefaultReservedRangeType() : $rangeType;
348
        }
349
350
        return $this->rangeType;
351
    }

src/Address/IPv6.php 1 location

@@ 424-435 (lines=12) @@
421
    {
422
        if ($this->rangeType === null) {
423
            $ipv4 = $this->toIPv4();
424
            if ($ipv4 !== null) {
425
                $this->rangeType = $ipv4->getRangeType();
426
            } else {
427
                $rangeType = null;
428
                foreach (static::getReservedRanges() as $reservedRange) {
429
                    $rangeType = $reservedRange->getAddressType($this);
430
                    if ($rangeType !== null) {
431
                        break;
432
                    }
433
                }
434
                $this->rangeType = $rangeType === null ? static::getDefaultReservedRangeType() : $rangeType;
435
            }
436
        }
437
438
        return $this->rangeType;