FileRenderer   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A render() 0 7 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