php abstract class event protected static db protected static user pub

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
abstract class event {
protected static $db;
protected static $user;
public static function init(database $db, user $user) {
self::$db = $db;
self::$user = $user;
}
public static function __callStatic($name, $arguments) {
switch ($name) {
case 'push':
if (count($arguments) == 4)
return self::_push(self::$user->data['id'], $arguments[0], $arguments[1], $arguments[2], $arguments[3]);
else return self::_push($arguments[0], $arguments[1], $arguments[2], $arguments[3], $arguments[4]);
break;
default:
return false;
}
}
protected static function _push($id, $text, $link, $from, $time) {
var_dump([$id, $text, $link, $from, $time]);
return true;
}
}