Completed
Branch dev (374206)
by James Ekow Abaka
06:04
created

Smarty   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 27
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSmarty() 0 11 2
A generate() 0 4 1
A generateFromString() 0 4 1
1
<?php
2
3
namespace ntentan\honam\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
    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
        if($this->smarty === null)
19
        {
20
            $this->smarty = new smarty\Engine();
21
        }
22
        $this->smarty->clearAllAssign();
23
        $data['honam'] = $this->getHelpersLoader();
24
        $this->smarty->assign($data);
25
        return $this->smarty;
26
    }
27
    
28
    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
        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