Code Duplication    Length = 10-13 lines in 2 locations

src/Detection/BrowserDetector.php 1 location

@@ 41-53 (lines=13) @@
38
        }
39
    }
40
41
    protected function detectByType(): array
42
    {
43
        foreach ($this->config as $type => $patternList) {
44
            if ($type === 'default') {
45
                continue;
46
            }
47
            $browser = $this->detectByPattern($patternList);
48
            if ($browser) {
49
                return array_merge($browser, ['type' => $type]);
50
            }
51
        }
52
        return [];
53
    }
54
}

src/Detection/OsDetector.php 1 location

@@ 54-63 (lines=10) @@
51
        return [];
52
    }
53
54
    private function detectByDeviceType($family): array
55
    {
56
        foreach ($this->config[$family] as $deviceType => $patternList) {
57
            $os = $this->detectByPattern($patternList);
58
            if ($os) {
59
                return array_merge($os, ['type' => $deviceType]);
60
            }
61
        }
62
        return [];
63
    }
64
65
}