Hooks   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 48
rs 10
c 0
b 0
f 0

3 Methods

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