Code Duplication    Length = 4-5 lines in 4 locations

htdocs/xoops_lib/Xoops/Core/Text/Sanitizer/Extensions/Clickable.php 4 locations

@@ 56-59 (lines=4) @@
53
        $pattern     = "/(^|[^]_a-z0-9-=\"'\/])([a-z]+?):\/\/([{$valid_chars}]+[{$end_chars}])/i";
54
        $text = preg_replace_callback(
55
            $pattern,
56
            function ($match) {
57
                return $match[1] . "<a href=\"$match[2]://$match[3]\" title=\"$match[2]://$match[3]\""
58
                . "rel=\"external\">$match[2]://".$this->truncate($match[3]).'</a>';
59
            },
60
            $text
61
        );
62
@@ 66-70 (lines=5) @@
63
        $pattern     = "/(^|[^]_a-z0-9-=\"'\/:\.])www\.((([a-zA-Z0-9\-]*\.){1,}){1}([a-zA-Z]{2,6}){1})((\/([a-zA-Z0-9\-\._\?\,\'\/\\+&%\$#\=~])*)*)/i";
64
        $text = preg_replace_callback(
65
            $pattern,
66
            function ($match) {
67
                return $match[1] ."<a href=\"http://www.$match[2]$match[6]\" "
68
                . "title=\"www.$match[2]$match[6]\" rel=\"external\">" .
69
                $this->truncate('www.'.$match[2].$match[6]) .'</a>';
70
            },
71
            $text
72
        );
73
@@ 77-81 (lines=5) @@
74
        $pattern     = "/(^|[^]_a-z0-9-=\"'\/])ftp\.([a-z0-9\-]+)\.([{$valid_chars}]+[{$end_chars}])/i";
75
        $text = preg_replace_callback(
76
            $pattern,
77
            function ($match) {
78
                return $match[1]."<a href=\"ftp://ftp.$match[2].$match[3]\" "
79
                . "title=\"ftp.$match[2].$match[3]\" rel=\"external\">"
80
                . $this->truncate('ftp.'.$match[2].$match[3]) .'</a>';
81
            },
82
            $text
83
        );
84
@@ 88-91 (lines=4) @@
85
        $pattern     = "/(^|[^]_a-z0-9-=\"'\/:\.])([-_a-z0-9\'+*$^&%=~!?{}]++(?:\.[-_a-z0-9\'+*$^&%=~!?{}]+)*+)@((?:(?![-.])[-a-z0-9.]+(?<![-.])\.[a-z]{2,6}|\d{1,3}(?:\.\d{1,3}){3})(?::\d++)?)/i";
86
        $text = preg_replace_callback(
87
            $pattern,
88
            function ($match) {
89
                return $match[1]. "<a href=\"mailto:$match[2]@$match[3]\" title=\"$match[2]@$match[3]\">"
90
                . $this->truncate($match[2] . "@" . $match[3]) . '</a>';
91
            },
92
            $text
93
        );
94