Completed
Pull Request — master (#13)
by Arnold
07:08
created

Twig::assertViewVariableName()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 4

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 7
cts 7
cp 1
rs 9.2
c 0
b 0
f 0
cc 4
eloc 6
nc 4
nop 1
crap 4
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();
25 1
        }
26
        
27 1
        return $this->viewer;
28
    }
29
    
30
    /**
31
     * Create a twig view object.
32
     * @ignore
33
     * @codeCoverageIgnore
34
     * 
35
     * @return TwigView;
0 ignored issues
show
Documentation introduced by
The doc-type TwigView; could not be parsed: Expected "|" or "end of type", but got ";" at position 8. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
36
     */
37
    protected function createTwigView($options)
38
    {
39
        return new TwigView($options);
40
    }
41
}
42