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

Smarty   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 27
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A generate() 0 4 1
A getSmarty() 0 11 2
A generateFromString() 0 4 1
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