Core::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 10
c 1
b 0
f 0
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
    public function __construct(string $tempDirectory)
12
    {
13
        parent::__construct();
14
        $this->temp = $tempDirectory;
15
        $this->setCompileDir("{$this->temp}/smarty_compiled_templates");
16
    }
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
    public function setData($data)
26
    {
27
        $this->clearAllAssign();
28
        $this->assign($data);
29
    }
30
}
31