Passed
Push — master ( f8e1da...c49986 )
by Edson
01:13
created

Content   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A removeTags() 0 3 1
A getContent() 0 9 2
1
<?php
2
3
namespace Sketch\Tpl;
4
5
class Content
6
{
7
    public function getContent(string $view, array $config): string
8
    {
9
        $file = getcwd() . '/' . $config['template_dir'] . "/$view.html";
10
11
        if (!file_exists($file)) {
12
            throw new \Exception("$file template not found"); // @codeCoverageIgnore
13
        }
14
15
        return $this->removeTags(file_get_contents($file));
16
    }
17
18
    public function removeTags($content)
19
    {
20
        return str_replace(array("<?", "?>"), array("&lt;?", "?&gt;"), $content);
21
    }
22
}
23