Code Duplication    Length = 18-18 lines in 2 locations

src/HtmlConverter.php 2 locations

@@ 143-160 (lines=18) @@
140
     *
141
     * @return string
142
     */
143
    protected function escapeWhiteTags($html)
144
    {
145
        if (count($this->whiteTags) > 0) {
146
            foreach ($this->whiteTags as $whiteTag) {
147
                //Search and replace the "<openTag" for "wildCard<code><openTag"
148
                $openTag = $this->getOpenTag($whiteTag);
149
                $replaceTag = sprintf('%s<code>%s', $this->wildCard, $openTag);
150
                $html = str_replace($openTag, $replaceTag, $html);
151
152
                //Search and replace the "closeTag>" for "closeTag></code>wildCard"
153
                $closeTag = $this->getCloseTag($whiteTag);
154
                $replaceTag = sprintf('%s</code>%s', $closeTag, $this->wildCard);
155
                $html = str_replace($closeTag, $replaceTag, $html);
156
            }
157
        }
158
159
        return $html;
160
    }
161
162
    /**
163
     * @param string $tag
@@ 290-307 (lines=18) @@
287
     *
288
     * @return string
289
     */
290
    protected function removeEscapedWhiteTags($markdown)
291
    {
292
        if (count($this->whiteTags) > 0) {
293
            foreach ($this->whiteTags as $whiteTag) {
294
                //Search and replace the "wildCard`<openTag" for "<openTag"
295
                $openTag = $this->getOpenTag($whiteTag);
296
                $openEscapedTag = sprintf('%s`%s', $this->wildCard, $openTag);
297
                $markdown = str_replace($openEscapedTag, $openTag, $markdown);
298
299
                //Search and replace the "closeTag>`wildCard" for "closeTag>"
300
                $closeTag = $this->getCloseTag($whiteTag);
301
                $closeEscapedTag = sprintf('%s`%s', $closeTag, $this->wildCard);
302
                $markdown = str_replace($closeEscapedTag, $closeTag, $markdown);
303
            }
304
        }
305
306
        return $markdown;
307
    }
308
}
309