SyntaxHighlighter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 19
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A highlight() 0 10 2
1
<?php
2
3
namespace Kaloa\Renderer;
4
5
/**
6
 * This is a transitional dummy class. GeSHi had to be removed because it was
7
 * licensed as GPL, not MIT.
8
 */
9
final class SyntaxHighlighter implements SyntaxHighlighterInterface
10
{
11
    /**
12
     *
13
     * @param string $source
14
     * @param string $language
15
     * @return string
16
     */
17
    public function highlight($source, $language = '')
18
    {
19 2
        $e = function ($s) {
20 2
            return htmlspecialchars($s, ENT_QUOTES, 'UTF-8');
21 2
        };
22
23 2
        $classStr = ('' === $language) ? ' class="language-none"' : ' class="language-' . $e($language) . '"';
24
25 2
        return '<pre><code' . $classStr . '>' . $e($source) . '</code></pre>';
26
    }
27
}
28