Code Duplication    Length = 18-18 lines in 2 locations

block/CodeTrait.php 1 location

@@ 26-43 (lines=18) @@
23
    /**
24
     * Consume lines for a code block
25
     */
26
    protected function consumeCode($lines, $current)
27
    {
28
        // consume until }}}
29
        $content = [];
30
        for ($i = $current + 1, $count = count($lines); $i < $count; $i++) {
31
            $line = rtrim($lines[$i]);
32
            if (strcmp($line, '}}}') !== 0) {
33
                $content[] = $line;
34
            } else {
35
                break;
36
            }
37
        }
38
        $block = [
39
            'code',
40
            'content' => implode("\n", $content),
41
        ];
42
        return [$block, $i];
43
    }
44
45
    /**
46
     * Renders a code block

block/RawHtmlTrait.php 1 location

@@ 38-55 (lines=18) @@
35
    /**
36
     * Consume lines for a raw html block
37
     */
38
    protected function consumeRawHtml($lines, $current)
39
    {
40
        // consume until >>>
41
        $content = [];
42
        for ($i = $current + 1, $count = count($lines); $i < $count; $i++) {
43
            $line = rtrim($lines[$i]);
44
            if (strcmp($line, '>>>') !== 0) {
45
                $content[] = $line;
46
            } else {
47
                break;
48
            }
49
        }
50
        $block = [
51
            'rawHtml',
52
            'content' => implode("\n", $content),
53
        ];
54
        return [$block, $i];
55
    }
56
57
    /**
58
     * Renders a raw html block