| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?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}");
- }
- }
|