| Code Coverage
| Classes and Traits | Functions and Methods | Lines
Total | 100.00% covered (success) | 100.00% | 1 / 1 | 100.00% covered (success) | 100.00% | 2 / 2 | CRAP | 100.00% covered (success) | 100.00% | 7 / 7
HookEvent | 100.00% covered (success) | 100.00% | 1 / 1 | 100.00% covered (success) | 100.00% | 2 / 2 | 4 | 100.00% covered (success) | 100.00% | 7 / 7
__construct | 100.00% covered (success) | 100.00% | 1 / 1 | 1 | 100.00% covered (success) | 100.00% | 4 / 4
__get | 100.00% covered (success) | 100.00% | 1 / 1 | 3 | 100.00% covered (success) | 100.00% | 3 / 3

1 | <?php
2 |
3 | namespace Tools;
4 |
5 | /**
6 | * Event's parameters
7 | * This classe is attached to a hook when fired
8 | **/
9 | class HookEvent
10 | {
11 | /**
12 | * @var \Tools\Context $context
13 | * /core/tools/Context.php
14 | * Contains website's informations
15 | **/
16 | private $context;
17 |
18 | /**
19 | * @var string $hookName
20 | * Contains hook name
21 | * Can be accessed read-only
22 | **/
23 | private $hookName;
24 |
25 | /**
26 | * @var mixed params
27 | * Contains parameters that can be passed to the hook when fired
28 | * Can be accessed read-only
29 | **/
30 | private $params;
31 |
32 | /**
33 | * Constructor
34 | **/
35 | public function __construct($hookName, $context, $params)
36 | {
37 | $this->context = $context;
38 | $this->hookName = $hookName;
39 | $this->params = $params;
40 | }
41 |
42 | /**
43 | * Getter
44 | **/
45 | public function __get($key)
46 | {
47 | switch ($key)
48 | {
49 | case "hookName": return $this->hookName; break;
50 | case "params": return $this->params; break;
51 | }
52 | throw new \Exception("Cannot access attribute {$key}");
53 | }
54 | }
55 |