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

MustacheEngine   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A generate() 0 5 1
A getTemplateFile() 0 4 1
A generateFromString() 0 5 1
1
<?php
2
3
namespace ntentan\honam\engines;
4
5
/**
6
 * Description of Mustache
7
 *
8
 * @author ekow
9
 */
10
class MustacheEngine extends AbstractEngine
0 ignored issues
show
Bug introduced by
There is at least one abstract method in this class. Maybe declare it as abstract, or implement the remaining methods: renderFromFileTemplate, renderFromStringTemplate
Loading history...
11
{
12
    private $stringRenderingEngine;
13
    private $fileRenderingEngine;
14
15
    /**
16
     *
17
     * @return \Mustache_Engine
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
18
     */
19
    public function __construct($stringRenderingEngine, $fileRenderingEngine)
20
    {
21
        $this->stringRenderingEngine = $stringRenderingEngine;
22
        $this->fileRenderingEngine = $fileRenderingEngine;
23
    }
24
25
    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...
26
    {
27
        $m = $this->getMustache();
0 ignored issues
show
Bug introduced by
The method getMustache() does not seem to exist on object<ntentan\honam\engines\MustacheEngine>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
28
        return $m->render($this->template, $data);
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...
29
    }
30
31
    public function getTemplateFile($name)
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...
32
    {
33
        return $this->resolveTemplateFile($name);
0 ignored issues
show
Bug introduced by
The method resolveTemplateFile() does not seem to exist on object<ntentan\honam\engines\MustacheEngine>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
34
    }
35
36
    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...
37
    {
38
        $m = $this->getMustache(false);
0 ignored issues
show
Bug introduced by
The method getMustache() does not seem to exist on object<ntentan\honam\engines\MustacheEngine>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
39
        return $m->render($string, $data);
40
    }
41
42
}
43