Completed
Push — dev ( 215a79...9219f8 )
by James Ekow Abaka
05:28
created

MustacheEngineFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 8 1
1
<?php
2
3
namespace ntentan\honam\factories;
4
5
use Mustache_Engine;
6
use ntentan\honam\engines\AbstractEngine;
7
use ntentan\honam\engines\mustache\MustacheLoader;
8
use ntentan\honam\engines\mustache\MustachePartialsLoader;
9
use ntentan\honam\engines\MustacheEngine;
10
use ntentan\honam\TemplateFileResolver;
11
12
13
class MustacheEngineFactory implements EngineFactoryInterface
14
{
15
    private $templateFileResolver;
16
17
    public function __construct(TemplateFileResolver $templateFileResolver)
18
    {
19
        $this->templateFileResolver = $templateFileResolver;
20
    }
21
22
    public function create() : AbstractEngine
23
    {
24
        $loaderMustache = new Mustache_Engine([
25
            'loader' => new MustacheLoader(), 'partials_loader' => new MustachePartialsLoader($templateFileResolver)]
0 ignored issues
show
Bug introduced by
The variable $templateFileResolver does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
26
        );
27
        $stringMustache = new Mustache_Engine(['partials_loader' => new MustachePartialsLoader($templateFileResolver)]);
28
        return new MustacheEngine($loaderMustache, $stringMustache);
29
    }
30
}
31