Code Duplication    Length = 10-13 lines in 2 locations

src/Detection/AbstractDetection.php 1 location

@@ 74-86 (lines=13) @@
71
        }
72
    }
73
74
    protected function detectByType(): array
75
    {
76
        foreach ($this->config as $type => $patternList) {
77
            if ($type === 'default') {
78
                continue;
79
            }
80
            $browser = $this->detectByPattern($patternList);
81
            if ($browser) {
82
                return array_merge($browser, ['type' => $type]);
83
            }
84
        }
85
        return [];
86
    }
87
}

src/Detection/OsDetector.php 1 location

@@ 44-53 (lines=10) @@
41
        return [];
42
    }
43
44
    private function detectByDeviceType($family): array
45
    {
46
        foreach ($this->config[$family] as $deviceType => $patternList) {
47
            $os = $this->detectByPattern($patternList);
48
            if ($os) {
49
                return array_merge($os, ['type' => $deviceType]);
50
            }
51
        }
52
        return [];
53
    }
54
55
}