Code Duplication    Length = 8-11 lines in 3 locations

src/Facets/PatternTrait.php 3 locations

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