Completed
Pull Request — master (#4)
by James Ekow Abaka
03:06 queued 36s
created

Core   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 22
ccs 8
cts 12
cp 0.6667
rs 10
c 0
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setData() 0 4 1
A __construct() 0 5 1
A __destruct() 0 4 3
1
<?php
2
namespace ntentan\honam\engines\smarty;
3
4
use ntentan\utils\Filesystem;
5
use Smarty;
6
7
class Core extends Smarty
8
{
9
    private $temp = '.';
10
11 1
    public function __construct(string $tempDirectory)
12
    {
13 1
        parent::__construct();
14 1
        $this->temp = $tempDirectory;
15 1
        $this->setCompileDir("{$this->temp}/smarty_compiled_templates");
16 1
    }
17
    
18
    public function __destruct() 
19
    {
20
        if($this->temp === '.' && file_exists("./smarty_compiled_templates")) {
21
            Filesystem::get("./smarty_compiled_templates")->delete();
22
        }
23
    }
24
25 1
    public function setData($data)
26
    {
27 1
        $this->clearAllAssign();
28 1
        $this->assign($data);
29 1
    }
30
}
31