Passed
Push — dev ( 191906...4ff9c3 )
by James Ekow Abaka
02:16
created

Core::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
namespace ntentan\honam\engines\smarty;
3
4
use ntentan\honam\factories\HelperVariable;
0 ignored issues
show
Bug introduced by
The type ntentan\honam\factories\HelperVariable was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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