summaryrefslogtreecommitdiffstats
path: root/src/Controller/View/PHP.php
blob: f49d9e5645405c19c30389f9e8421c5d74845313 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php

namespace Jasny\Controller\View;

use Jasny\Controller\View;
use Jasny\View\PHP as PHPView;

/**
 * View using PHP
 */
trait PHP
{
    use View;
    
    /**
     * Get the template engine abstraction
     * 
     * @return PHPView
     */
    public function getViewer()
    {
        if (!isset($this->viewer)) {
            $this->viewer = $this->createPHPView(['path' => $this->getViewPath()]);
        }
        
        return $this->viewer;
    }
    
    /**
     * Create a twig view object.
     * @ignore
     * @codeCoverageIgnore
     * 
     * @return PHPView
     */
    protected function createPHPView($options)
    {
        return new PHPView($options);
    }
}