Completed
Push — dev ( a486ee...7113e4 )
by James Ekow Abaka
03:55
created

Core   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 69.23%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 3
dl 0
loc 24
ccs 9
cts 13
cp 0.6923
rs 10
c 0
b 0
f 0

3 Methods

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