35 lines
681 B
PHP
35 lines
681 B
PHP
|
<?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
|