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
@@ 109-116 (lines=8) @@
106
     *
107
     * @return string
108
     */
109
    private function processRegexSlashD($patternToProcess)
110
    {
111
        // Any character except those matched by '\d'.
112
        $patternToProcess = str_replace('\D', '[^(\d)]', $patternToProcess);
113
        // Any Decimal digit. A shortcut for '\p{Nd}'.
114
        $patternToProcess = str_replace('\d', '\p{Nd)', $patternToProcess);
115
        return $patternToProcess;
116
    }
117
118
    /**
119
     * @param string $patternToProcess
@@ 123-133 (lines=11) @@
120
     *
121
     * @return string
122
     */
123
    private function processRegexSlashW($patternToProcess)
124
    {
125
        // Any character except those matched by '\w'.
126
        $patternToProcess = str_replace('\W', '[^\w]', $patternToProcess);
127
        // Any character that might appear in a word. A shortcut for '[#X0000-#x10FFFF]-[\p{P}\p{Z}\p{C}]'
128
        // (all characters except the set of "punctuation", "separator", and "other" characters).
129
        $patternToProcess = str_replace('\w', '([\x{0000}-\x{10FFFF}]-[\p{P}\p{Z}\p{C}])',
130
            $patternToProcess);
131
        return $patternToProcess;
132
133
    }
134
135
    /**
136
     * @param string $pattern