Completed
Push — master ( 02b122...2a8558 )
by James Ekow Abaka
02:43
created

Smarty::generate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace ntentan\honam\template_engines;
4
5
use ntentan\honam\TemplateEngine;
6
7
/**
8
 * Description of Mustache
9
 *
10
 * @author ekow
11
 */
12
class Smarty extends TemplateEngine
13
{
14
    private $smarty;
15
    
16 2
    private function getSmarty($data)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
17
    {
18 2
        if($this->smarty === null)
19
        {
20 2
            $this->smarty = new smarty\Engine();
21
        }
22 2
        $this->smarty->clearAllAssign();
23 2
        $data['honam'] = $this->getHelpersLoader();
24 2
        $this->smarty->assign($data);
25 2
        return $this->smarty;
26
    }
27
    
28 2
    protected function generate($data) 
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
29
    {
30 2
        return $this->getSmarty($data)->fetch($this->template);
31
    }
32
33
    protected function generateFromString($string, $data)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
34
    {
35
        return $this->getSmarty($data)->display("string:$string");
36
    }
37
38
}
39