Completed
Push — master ( 73fd8c...52e26d )
by Rougin
01:31
created

ViewHelper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 45
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A include() 0 10 1
A name() 0 4 1
1
<?php
2
3
namespace Staticka\Helper;
4
5
use Staticka\Website;
6
7
/**
8
 * View Helper
9
 *
10
 * @package Rouginsons
11
 * @author  Rougin Royce Gutib <[email protected]>
12
 */
13
class ViewHelper implements HelperInterface
14
{
15
    /**
16
     * @var \Staticka\Website
17
     */
18
    protected $website;
19
20
    /**
21
     * Initializes the helper instance.
22
     *
23
     * @param \Staticka\Website $website
24
     */
25
    public function __construct(Website $website)
26
    {
27
        $this->website = $website;
28
    }
29
30
    /**
31
     * Returns the partial template.
32
     *
33
     * @param  string $template
34
     * @param  array  $data
35
     * @return string
36
     */
37
    public function include($template, array $data = array())
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
    {
39
        $data = (array) $this->website->helpers();
40
41
        $data['config'] = $this->website;
42
43
        $renderer = $this->website->renderer();
44
45
        return $renderer->render($template, $data);
46
    }
47
48
    /**
49
     * Returns the name of the helper.
50
     *
51
     * @return string
52
     */
53
    public function name()
54
    {
55
        return 'view';
56
    }
57
}
58