Html   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 88
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 88
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setTemplate() 0 5 1
A getTemplate() 0 4 1
A addCustomCss() 0 4 1
A getCustomCss() 0 4 1
A getCustomJs() 0 4 1
A addCustomJs() 0 4 1
A render() 0 10 1
1
<?php
2
3
namespace AtDataGrid\Renderer;
4
5
use Zend\View\Model\ViewModel;
6
7
class Html implements RendererInterface
8
{
9
    /**
10
     * Html template
11
     *
12
     * @var string
13
     */
14
    protected $template = 'at-datagrid/grid';
15
16
    /**
17
     * Additional css files
18
     *
19
     * @var string
20
     */
21
    protected $customCss = [];
22
23
    /**
24
     * Additional js files
25
     *
26
     * @var string
27
     */
28
    protected $customJs = [];
29
30
    /**
31
     * @param $template
32
     * @return $this
33
     */
34
    public function setTemplate($template)
35
    {
36
        $this->template = $template;
37
        return $this;
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    public function getTemplate()
44
    {
45
        return $this->template;
46
    }
47
48
    /**
49
     * @param string $customCss
50
     */
51
    public function addCustomCss($customCss)
52
    {
53
        $this->customCss[] = $customCss;
54
    }
55
56
    /**
57
     * @return string
58
     */
59
    public function getCustomCss()
60
    {
61
        return $this->customCss;
62
    }
63
64
    /**
65
     * @return string
66
     */
67
    public function getCustomJs()
68
    {
69
        return $this->customJs;
70
    }
71
72
    /**
73
     * @param string $customJs
74
     */
75
    public function addCustomJs($customJs)
76
    {
77
        $this->customJs[] = $customJs;
78
    }
79
80
    /**
81
     * @param array $variables
82
     * @return ViewModel
83
     */
84
    public function render(array $variables = [])
85
    {
86
        $variables['customCss'] = $this->getCustomCss();
87
        $variables['customJs'] = $this->getCustomJs();
88
89
        $viewModel = new ViewModel($variables);
90
        $viewModel->setTemplate($this->getTemplate());
91
92
        return $viewModel;
93
    }
94
}