Code Duplication    Length = 8-11 lines in 5 locations

src/Facets/PatternTrait.php 5 locations

@@ 55-62 (lines=8) @@
52
        return $patternToProcess;
53
    }
54
55
    private function processRegexSlashS($patternToProcess)
56
    {
57
        // Any character except those matched by '\s'.
58
        $patternToProcess = str_replace('\S', '[^\s]', $patternToProcess);
59
        // Whitespace, specifically '' (space), '\t' (tab), '\n' (newline) and '\r' (return).
60
        $patternToProcess = str_replace('\s', '[\x{20}\t\n\r]', $patternToProcess);
61
        return $patternToProcess;
62
    }
63
64
    private function processRegexSlashI($patternToProcess)
65
    {
@@ 64-73 (lines=10) @@
61
        return $patternToProcess;
62
    }
63
64
    private function processRegexSlashI($patternToProcess)
65
    {
66
        // Any character except those matched by '\i'.
67
        $patternToProcess = str_replace('\I', '[^\i]', $patternToProcess);
68
        // The first character in an XML identifier. Specifically, any letter, the character '_', or the character ':',
69
        // See the XML Recommendation for the complex specification of a letter. This character represents a subset of
70
        // letter that might appear in '\c'.
71
        $patternToProcess = str_replace('\i', self::$Letter . '|_|:', $patternToProcess);
72
        return $patternToProcess;
73
    }
74
75
    private function processRegexSlashC($patternToProcess)
76
    {
@@ 75-84 (lines=10) @@
72
        return $patternToProcess;
73
    }
74
75
    private function processRegexSlashC($patternToProcess)
76
    {
77
        // Any character except those matched by '\c'.
78
        $patternToProcess = str_replace('\C', '[^\i]', $patternToProcess);
79
        // Any character that might appear in the built-in NMTOKEN datatype.
80
        // See the XML Recommendation for the complex specification of a NameChar.
81
        $patternToProcess = str_replace('\c', self::$NameChar, $patternToProcess);
82
        return $patternToProcess;
83
84
    }
85
86
    private function processRegexSlashD($patternToProcess)
87
    {
@@ 86-93 (lines=8) @@
83
84
    }
85
86
    private function processRegexSlashD($patternToProcess)
87
    {
88
        // Any character except those matched by '\d'.
89
        $patternToProcess = str_replace('\D', '[^\d]', $patternToProcess);
90
        // Any Decimal digit. A shortcut for '\p{Nd}'.
91
        $patternToProcess = str_replace('\d', '\p{Nd)', $patternToProcess);
92
        return $patternToProcess;
93
    }
94
95
    private function processRegexSlashW($patternToProcess)
96
    {
@@ 95-105 (lines=11) @@
92
        return $patternToProcess;
93
    }
94
95
    private function processRegexSlashW($patternToProcess)
96
    {
97
        // Any character except those matched by '\w'.
98
        $patternToProcess = str_replace('\W', '[^\w]', $patternToProcess);
99
        // Any character that might appear in a word. A shortcut for '[#X0000-#x10FFFF]-[\p{P}\p{Z}\p{C}]'
100
        // (all characters except the set of "punctuation", "separator", and "other" characters).
101
        $patternToProcess = str_replace('\w', '[\x{0000}-\x{10FFFF}]-[\p{P}\p{Z}\p{C}]',
102
            $patternToProcess);
103
        return $patternToProcess;
104
105
    }
106
107
    /**
108
     * @param string $pattern