ZendView::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * MtMail - e-mail module for Zend Framework
4
 *
5
 * @link      http://github.com/mtymek/MtMail
6
 * @copyright Copyright (c) 2013-2017 Mateusz Tymek
7
 * @license   BSD 2-Clause
8
 */
9
10
namespace MtMail\Renderer;
11
12
use Zend\View\Model\ModelInterface;
13
use Zend\View\View;
14
15
/**
16
 * Re-use Zend\View in order to render template with children
17
 */
18
class ZendView extends View implements RendererInterface
19
{
20
    /**
21
     * @var View
22
     */
23
    protected $view;
24
25
    /**
26
     * Class constructor
27
     *
28
     * @param View $view
29
     */
30 2
    public function __construct(View $view)
31
    {
32 2
        $this->view = $view;
33 2
    }
34
35
    /**
36
     * @param  ModelInterface $model
37
     * @return string
38
     */
39 1
    public function render(ModelInterface $model)
40
    {
41
        // quirk - setting has_parent to true will force
42
        // View::render to return output
43 1
        $model->setOption('has_parent', true);
44
45 1
        return $this->view->render($model);
46
    }
47
}
48