Template::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 9
cts 9
cp 1
rs 9.4286
cc 1
eloc 7
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arnaud
5
 * Date: 21/11/15
6
 * Time: 17:25
7
 */
8
9
namespace Ndrx\Profiler\Renderer\Html;
10
11
class Template
12
{
13
14
    /**
15
     * @var \Twig_Environment
16
     */
17
    protected $engine;
18
19
    protected static $instance;
20
21
    /**
22
     *
23
     */
24 2
    protected function __construct()
25
    {
26 2
        $loader = new \Twig_Loader_Filesystem([
27 2
            __DIR__ . DIRECTORY_SEPARATOR . '..'
28 2
            . DIRECTORY_SEPARATOR . '..'
29 2
            . DIRECTORY_SEPARATOR . '..'
30 2
            . DIRECTORY_SEPARATOR . 'views'
31 2
        ]);
32 2
        $this->engine = new \Twig_Environment($loader);
33 2
    }
34
35
    /**
36
     * @return Template
37
     */
38 88
    public static function getInstance()
39
    {
40 88
        if (self::$instance === null) {
41 2
            self::$instance = new self();
42 2
        }
43
44 88
        return self::$instance;
45
    }
46
47
    /**
48
     * @return \Twig_Environment
49
     */
50 88
    public function getEngine()
51
    {
52 88
        return $this->engine;
53
    }
54
}
55