Completed
Push — master ( 9ff920...9bd36f )
by Olivier
14:19 queued 07:48
created

Hooks::view_lazy_get_engines()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
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\View;
13
14
use ICanBoogie\PropertyNotDefined;
15
use ICanBoogie\Render;
16
use ICanBoogie\Render\TemplateResolver;
17
use ICanBoogie\Routing\Controller;
18
use ICanBoogie\View\View;
19
20
class Hooks
21
{
22
	/*
23
	 * Prototypes
24
	 */
25
26
	/**
27
	 * Returns a view for a controller.
28
	 *
29
	 * @param Controller $controller
30
	 *
31
	 * @return View
32
	 */
33
	static public function controller_get_view(Controller $controller)
34
	{
35
		$view = new View($controller, Render\get_renderer());
36
37
		new View\AlterEvent($view);
38
39
		return $view;
40
	}
41
42
	/**
43
	 * Avoids a trip to `assert_property_is_readable` for controllers or routes that do not
44
	 * define a `template` property.
45
	 *
46
	 * @param $target
47
	 *
48
	 * @throws PropertyNotDefined
49
	 */
50
	static public function get_template($target)
51
	{
52
		throw new PropertyNotDefined([ 'template', $target ]);
53
	}
54
55
	/**
56
	 * Avoids a trip to `assert_property_is_readable` for controllers or routes that do not
57
	 * define a `layout` property.
58
	 *
59
	 * @param $target
60
	 *
61
	 * @throws PropertyNotDefined
62
	 */
63
	static public function get_layout($target)
64
	{
65
		throw new PropertyNotDefined([ 'layout', $target ]);
66
	}
67
}
68