Content::getContent()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 0
loc 10
ccs 0
cts 7
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Bonfim\Tpl;
4
5
class Content
6
{
7
    public static function getContent(string $view): string
8
    {
9
        $view = str_replace('.', '/', $view);
10
        $file = Tpl::getDir() . "$view.php";
11
12
        if (!file_exists($file)) {
13
            throw new \Exception("$file template not found"); // @codeCoverageIgnore
14
        }
15
16
        return file_get_contents($file);
17
    }
18
}
19