Code Duplication    Length = 9-9 lines in 2 locations

inline/LinkTrait.php 2 locations

@@ 91-99 (lines=9) @@
88
    {
89
        if (!in_array('parseLink', array_slice($this->context, 1)) && preg_match('/^\[\[(.*?)\]\]/', $markdown, $matches)) {
90
            // '[[link]]
91
            if (preg_match('/^(.+?)\|(.*)$/', $matches[1], $parts)) {
92
                // 'link|text' pattern
93
                $url = $parts[1];
94
                $text = ($parts[2] == '') ? $parts[1] : $parts[2];
95
            } else {
96
                // 'link' only pattern
97
                $url = $matches[1];
98
                $text = $matches[1];
99
            }
100
            if (!preg_match('/^(https?|ftp):\/\//', $url)) {
101
                // not an external link, i.e., a wiki link
102
                if (preg_match('/^(.*):(.*)$/', $url, $urlMatches)) {
@@ 149-157 (lines=9) @@
146
    {
147
        if (preg_match('/^\{\{(.*?)\}\}/', $markdown, $matches)) {
148
            // '{{image}}
149
            if (preg_match('/^(.+?)\|(.*)$/', $matches[1], $parts)) {
150
                // 'image|text' pattern
151
                $url = $parts[1];
152
                $text = ($parts[2] == '') ? $parts[1] : $parts[2];
153
            } else {
154
                // 'image' only pattern
155
                $url = $matches[1];
156
                $text = $matches[1];
157
            }
158
            if ($url == $text) {
159
                if (preg_match('/([^\/]+\.(jpe?g|png|gif))/i', $url, $fileMatches)) {
160
                    $text = $fileMatches[1];