Total Complexity | 4 |
Total Lines | 45 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
15 | class ViewHelper implements HelperContract |
||
16 | { |
||
17 | /** |
||
18 | * @var \Staticka\Contracts\RendererContract |
||
19 | */ |
||
20 | protected $renderer; |
||
21 | |||
22 | /** |
||
23 | * TODO: Remove Website instance in v1.0.0. |
||
24 | * RendererContract should only be used. |
||
25 | * |
||
26 | * Initializes the helper instance. |
||
27 | * |
||
28 | * @param \Staticka\Contracts\WebsiteContract|\Staticka\Contracts\RendererContract $website |
||
29 | */ |
||
30 | 6 | public function __construct($renderer) |
|
31 | { |
||
32 | 6 | if ($renderer instanceof WebsiteContract) |
|
33 | 2 | { |
|
34 | 6 | $renderer = $renderer->renderer(); |
|
35 | 2 | } |
|
36 | |||
37 | 6 | $this->renderer = $renderer; |
|
38 | 6 | } |
|
39 | |||
40 | /** |
||
41 | * Renders the partial template. |
||
42 | * |
||
43 | * @param string $name |
||
44 | * @param array $data |
||
45 | * @return string |
||
46 | */ |
||
47 | 3 | public function render($name, array $data = array()) |
|
50 | } |
||
51 | |||
52 | /** |
||
53 | * Returns the name of the helper. |
||
54 | * |
||
55 | * @return string |
||
56 | */ |
||
57 | 3 | public function name() |
|
62 |