Italic::render()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php # -*- coding: utf-8 -*-
2
declare(strict_types=1);
3
4
namespace Bueltge\Marksimple\Rule;
5
6
class Italic extends AbstractRegexRule
7
{
8
9
    /**
10
     * Get the regex rule to identify the content for the callback.
11
     * Italic formatting via one star * or one underline _.
12
     *
13
     * @return string
14
     */
15 8
    public function rule(): string
16 8
    {
17 8
        return '#(?<!\\\)([*_])([^\n|`]+?)\1#';
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23 5
    public function render(array $content): string
24 5
    {
25 5
        return sprintf('<em>%s</em>', $content[2]);
26
    }
27
}
28