FileRenderer::render()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 5
c 2
b 0
f 1
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
// phpcs:disable Generic.PHP.ForbiddenFunctions
6
7
namespace midorikocak\view;
8
9
use function extract;
10
use function ob_get_clean;
11
use function ob_start;
12
13
use const EXTR_OVERWRITE;
14
15
class FileRenderer implements RendererInterface
16
{
17 3
    public function render(string $filename, array $data = []): string
18
    {
19
        return (function () use ($filename, $data) {
20 3
            ob_start();
21 3
            extract($data, EXTR_OVERWRITE);
22 3
            include $filename;
23 3
            return ob_get_clean();
24 3
        })();
25
    }
26
}
27