Completed
Push — dev ( 48451b...8a2d43 )
by James Ekow Abaka
08:16
created

SmartyEngine::renderFromStringTemplate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace ntentan\honam\engines;
4
5
6
use ntentan\honam\template_engines\smarty\Engine;
7
8
/**
9
 * Description of Mustache
10
 *
11
 * @author ekow
12
 */
13
class SmartyEngine extends AbstractEngine
14
{
15
    private $smarty;
16
17
    public function __construct(Engine $smarty)
0 ignored issues
show
Unused Code introduced by
The parameter $smarty is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
    {
19
20
    }
21
22
    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...
23
    {
24
        if($this->smarty === null)
25
        {
26
        }
27
        $this->smarty->clearAllAssign();
28
        $this->smarty->assign($data);
29
        return $this->smarty;
30
    }
31
    
32
    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...
33
    {
34
        return $this->getSmarty($data)->fetch($this->template);
0 ignored issues
show
Bug introduced by
The property template does not seem to exist. Did you mean templateRenderer?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
35
    }
36
37
    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...
38
    {
39
        return $this->getSmarty($data)->display("string:$string");
40
    }
41
42
    /**
43
     * Passes the data to be rendered to the template engine instance.
44
     * @param string $filePath
45
     * @param array $data
46
     * @return string
47
     */
48
    public function renderFromFileTemplate(string $filePath, array $data): string
49
    {
50
        // TODO: Implement renderFromFileTemplate() method.
51
    }
52
53
    /**
54
     * Passes a template string and data to be rendered to the template engine
55
     * instance.
56
     * @param string $string
57
     * @param array $data
58
     * @return string
59
     */
60
    public function renderFromStringTemplate(string $string, array $data): string
61
    {
62
        // TODO: Implement renderFromStringTemplate() method.
63
    }
64
}
65