ZendView   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 30
ccs 6
cts 6
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A render() 0 8 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