eesyphp/src/HookEvent.php

35 lines
681 B
PHP
Raw Normal View History

2023-01-29 19:57:26 +01:00
<?php
namespace EesyPHP;
use JsonSerializable;
class HookEvent implements JsonSerializable {
private $name;
private $data;
function __construct($name, $data) {
$this -> name = $name;
$this -> data = $data;
}
function __get($key) {
if ($key == 'name')
return $this -> name;
elseif ($key == 'data')
return $this -> data;
elseif (is_array($this -> data) && array_key_exists($key, $this -> data))
return $this -> data[$key];
return null;
}
public function jsonSerialize() {
return array (
'name' => $this -> name,
'data' => $this -> data,
);
}
}
# vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab