Code Duplication    Length = 8-11 lines in 3 locations

src/Facets/PatternTrait.php 3 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
    {
@@ 89-96 (lines=8) @@
86
87
    }
88
89
    private function processRegexSlashD($patternToProcess)
90
    {
91
        // Any character except those matched by '\d'.
92
        $patternToProcess = str_replace('\D', '[^(\d)]', $patternToProcess);
93
        // Any Decimal digit. A shortcut for '\p{Nd}'.
94
        $patternToProcess = str_replace('\d', '\p{Nd)', $patternToProcess);
95
        return $patternToProcess;
96
    }
97
98
    private function processRegexSlashW($patternToProcess)
99
    {
@@ 98-108 (lines=11) @@
95
        return $patternToProcess;
96
    }
97
98
    private function processRegexSlashW($patternToProcess)
99
    {
100
        // Any character except those matched by '\w'.
101
        $patternToProcess = str_replace('\W', '[^\w]', $patternToProcess);
102
        // Any character that might appear in a word. A shortcut for '[#X0000-#x10FFFF]-[\p{P}\p{Z}\p{C}]'
103
        // (all characters except the set of "punctuation", "separator", and "other" characters).
104
        $patternToProcess = str_replace('\w', '([\x{0000}-\x{10FFFF}]-[\p{P}\p{Z}\p{C}])',
105
            $patternToProcess);
106
        return $patternToProcess;
107
108
    }
109
110
    /**
111
     * @param string $pattern