Pre   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 4
c 2
b 0
f 0
dl 0
loc 21
ccs 7
cts 7
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rule() 0 3 1
A render() 0 4 1
1
<?php # -*- coding: utf-8 -*-
2
declare(strict_types=1);
3
4
namespace Bueltge\Marksimple\Rule;
5
6
class Pre extends AbstractRegexRule
7
{
8
9
    /**
10
     * Get the regex rule to identify the content for the callback.
11
     * Code blocks via 4 spaces or tab.
12
     *
13
     * @return string
14
     */
15 5
    public function rule(): string
16 5
    {
17 5
        return '#^(?:\0(.*?)\0\n)?( {4}|\t)(.*?)$#m';
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23 2
    public function render(array $content): string
24 2
    {
25 2
        $content = sprintf('<pre><code>%s</code></pre>', $content[3]);
26 2
        return $content;
27
    }
28
}
29