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

Core::setData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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