Code Duplication    Length = 3-3 lines in 6 locations

src/WebServer/ApacheWebServer.php 3 locations

@@ 44-46 (lines=3) @@
41
        $parsedActiveConfig = [];
42
43
        foreach ($activeConfig as $line => $directive) {
44
            if (preg_match('/^<If(Module|Define)\s+(\w+)>/i', trim($directive), $matches)) {
45
                $parsedActiveConfig[$line] = ['module section', $matches[2]];
46
            }
47
            if (preg_match('/^<(((Directory|Files|Location)(Match)?)|VirtualHost)/i', trim($directive), $matches)) {
48
                $parsedActiveConfig[$line] = ['scope section', $matches[2]];
49
            }
@@ 47-49 (lines=3) @@
44
            if (preg_match('/^<If(Module|Define)\s+(\w+)>/i', trim($directive), $matches)) {
45
                $parsedActiveConfig[$line] = ['module section', $matches[2]];
46
            }
47
            if (preg_match('/^<(((Directory|Files|Location)(Match)?)|VirtualHost)/i', trim($directive), $matches)) {
48
                $parsedActiveConfig[$line] = ['scope section', $matches[2]];
49
            }
50
            /*if (preg_match('/^Include(Optional)?\s+(.+)/i', trim($directive), $matches)) {
51
                $parsedActiveConfig[$line] = ['include directive', $matches[2]];
52
            }*/
@@ 53-55 (lines=3) @@
50
            /*if (preg_match('/^Include(Optional)?\s+(.+)/i', trim($directive), $matches)) {
51
                $parsedActiveConfig[$line] = ['include directive', $matches[2]];
52
            }*/
53
            if (preg_match('/^(\w+)\s+(.+)/i', trim($directive), $matches)) {
54
                $parsedActiveConfig[$line] = ['directive', [$matches[1], $matches[2]]];
55
            }
56
        }
57
58
        return $parsedActiveConfig;

src/WebServer/NginxWebServer.php 3 locations

@@ 44-46 (lines=3) @@
41
        $parsedActiveConfig = [];
42
43
        foreach ($activeConfig as $line => $directive) {
44
            if (preg_match('/(?P<key>\w+)\s+(?P<value>[^;]+);/', $directive, $matches)) {
45
                $parsedActiveConfig[$line] = ['simple directive', [$matches['key'] => $matches['value']]];
46
            }
47
            if (preg_match('/(?P<key>\w+)\s+(?P<value>[^\s{+])\s*{/', $directive, $matches)) {
48
                $parsedActiveConfig[$line] = ['block directive', [$matches['key'] => $matches['value']]];
49
            }
@@ 47-49 (lines=3) @@
44
            if (preg_match('/(?P<key>\w+)\s+(?P<value>[^;]+);/', $directive, $matches)) {
45
                $parsedActiveConfig[$line] = ['simple directive', [$matches['key'] => $matches['value']]];
46
            }
47
            if (preg_match('/(?P<key>\w+)\s+(?P<value>[^\s{+])\s*{/', $directive, $matches)) {
48
                $parsedActiveConfig[$line] = ['block directive', [$matches['key'] => $matches['value']]];
49
            }
50
            if (preg_match('/(?P<key>\w+)\s*{/', $directive, $matches)) {
51
                $parsedActiveConfig[$line] = ['context', $matches['key']];
52
            }
@@ 50-52 (lines=3) @@
47
            if (preg_match('/(?P<key>\w+)\s+(?P<value>[^\s{+])\s*{/', $directive, $matches)) {
48
                $parsedActiveConfig[$line] = ['block directive', [$matches['key'] => $matches['value']]];
49
            }
50
            if (preg_match('/(?P<key>\w+)\s*{/', $directive, $matches)) {
51
                $parsedActiveConfig[$line] = ['context', $matches['key']];
52
            }
53
        }
54
55
        return $parsedActiveConfig;