Completed
Push — master ( 7f6ab6...0b9ac4 )
by Arnold
07:54 queued 04:52
created

Twig::getViewer()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 5
cts 5
cp 1
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Jasny\Controller\View;
4
5
use Jasny\Controller\View;
6
use Jasny\View\Twig as TwigView;
7
8
/**
9
 * View using Twig
10
 */
11
trait Twig
12
{
13
    use View;
14
    
15
    /**
16
     * Get the template engine abstraction
17
     * 
18
     * @return TwigView
19
     */
20 1
    public function getViewer()
21
    {
22 1
        if (!isset($this->viewer)) {
23 1
            $this->viewer = $this->createTwigView(['path' => $this->getViewPath()]);
24 1
            $this->viewer->addDefaultExtensions();
0 ignored issues
show
Deprecated Code introduced by
The method Jasny\View\Twig::addDefaultExtensions() has been deprecated.

This method has been deprecated.

Loading history...
25
        }
26
        
27 1
        return $this->viewer;
28
    }
29
    
30
    /**
31
     * Create a twig view object.
32
     * @ignore
33
     * @codeCoverageIgnore
34
     * 
35
     * @return TwigView
36
     */
37
    protected function createTwigView($options)
38
    {
39
        return new TwigView($options);
40
    }
41
}
42