Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 7 |
| HookEvent | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 7 |
| __construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
| __get | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 3 |
|||
| <?php | |
| namespace Tools; | |
| /** | |
| * Event's parameters | |
| * This classe is attached to a hook when fired | |
| **/ | |
| class HookEvent | |
| { | |
| /** | |
| * @var \Tools\Context $context | |
| * /core/tools/Context.php | |
| * Contains website's informations | |
| **/ | |
| private $context; | |
| /** | |
| * @var string $hookName | |
| * Contains hook name | |
| * Can be accessed read-only | |
| **/ | |
| private $hookName; | |
| /** | |
| * @var mixed params | |
| * Contains parameters that can be passed to the hook when fired | |
| * Can be accessed read-only | |
| **/ | |
| private $params; | |
| /** | |
| * Constructor | |
| **/ | |
| public function __construct($hookName, $context, $params) | |
| { | |
| $this->context = $context; | |
| $this->hookName = $hookName; | |
| $this->params = $params; | |
| } | |
| /** | |
| * Getter | |
| **/ | |
| public function __get($key) | |
| { | |
| switch ($key) | |
| { | |
| case "hookName": return $this->hookName; break; | |
| case "params": return $this->params; break; | |
| } | |
| throw new \Exception("Cannot access attribute {$key}"); | |
| } | |
| } | |