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

MustacheEngineFactory::__construct()   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 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