Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
7 / 7 |
| HookEvent | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
4 | |
100.00% |
7 / 7 |
| __construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
4 / 4 |
|||
| __get | |
100.00% |
1 / 1 |
3 | |
100.00% |
3 / 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}"); | |
| } | |
| } | |