Code Duplication    Length = 8-11 lines in 3 locations

src/Facets/PatternTrait.php 3 locations

@@ 60-67 (lines=8) @@
57
     *
58
     * @return string
59
     */
60
    private function processRegexSlashS($patternToProcess)
61
    {
62
        // Any character except those matched by '\s'.
63
        $patternToProcess = str_replace('\S', '[^\s]', $patternToProcess);
64
        // Whitespace, specifically '' (space), '\t' (tab), '\n' (newline) and '\r' (return).
65
        $patternToProcess = str_replace('\s', '([\x{20}\t\n\r])', $patternToProcess);
66
        return $patternToProcess;
67
    }
68
69
    /**
70
     * @param string $patternToProcess
@@ 108-115 (lines=8) @@
105
     *
106
     * @return string
107
     */
108
    private function processRegexSlashD($patternToProcess)
109
    {
110
        // Any character except those matched by '\d'.
111
        $patternToProcess = str_replace('\D', '[^(\d)]', $patternToProcess);
112
        // Any Decimal digit. A shortcut for '\p{Nd}'.
113
        $patternToProcess = str_replace('\d', '\p{Nd)', $patternToProcess);
114
        return $patternToProcess;
115
    }
116
117
    /**
118
     * @param string $patternToProcess
@@ 122-132 (lines=11) @@
119
     *
120
     * @return string
121
     */
122
    private function processRegexSlashW($patternToProcess)
123
    {
124
        // Any character except those matched by '\w'.
125
        $patternToProcess = str_replace('\W', '[^\w]', $patternToProcess);
126
        // Any character that might appear in a word. A shortcut for '[#X0000-#x10FFFF]-[\p{P}\p{Z}\p{C}]'
127
        // (all characters except the set of "punctuation", "separator", and "other" characters).
128
        $patternToProcess = str_replace('\w', '([\x{0000}-\x{10FFFF}]-[\p{P}\p{Z}\p{C}])',
129
            $patternToProcess);
130
        return $patternToProcess;
131
    }
132
133
    /**
134
     * @param string $pattern
135
     *