Hooks::get_renderer()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the ICanBoogie package.
5
 *
6
 * (c) Olivier Laviale <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ICanBoogie\Binding\Render;
13
14
use ICanBoogie\Core;
15
use ICanBoogie\Render;
16
use ICanBoogie\Render\EngineCollection;
17
use ICanBoogie\Render\Renderer;
18
use ICanBoogie\Render\TemplateResolver;
19
20
class Hooks
21
{
22
	/*
23
	 * Events
24
	 */
25
26
	/**
27
	 * Decorates the template resolver with an {@link ApplicationTemplateResolver} instance.
28
	 *
29
	 * @param TemplateResolver\AlterEvent $event
30
	 * @param TemplateResolver $target
31
	 */
32
	static public function alter_template_resolver(TemplateResolver\AlterEvent $event, TemplateResolver $target)
0 ignored issues
show
Unused Code introduced by
The parameter $target 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...
33
	{
34
		$event->instance = new ApplicationTemplateResolver($event->instance, \ICanBoogie\get_autoconfig()['app-paths']);
35
	}
36
37
	/*
38
	 * Prototypes
39
	 */
40
41
	/**
42
	 * Returns an engine collection.
43
	 *
44
	 * @return EngineCollection
45
	 */
46
	static public function get_template_engines()
47
	{
48
		return Render\get_engines();
49
	}
50
51
	/**
52
	 * Returns a clone of the shared template resolver.
53
	 *
54
	 * @return TemplateResolver
55
	 */
56
	static public function get_template_resolver()
57
	{
58
		return clone Render\get_template_resolver();
59
	}
60
61
	/**
62
	 * Returns a clone of the shared renderer.
63
	 *
64
	 * @return Renderer
65
	 */
66
	static public function get_renderer()
67
	{
68
		return clone Render\get_renderer();
69
	}
70
71
	/**
72
	 * Renders a template.
73
	 *
74
	 * @param Core|CoreBindings $app
75
	 * @param mixed $target_or_options
76
	 * @param array $additional_options
77
	 *
78
	 * @return mixed
79
	 */
80
	static public function render(Core $app, $target_or_options, array $additional_options = [])
81
	{
82
		return $app->renderer->render($target_or_options, $additional_options);
83
	}
84
}
85