1 | <?php |
||
11 | class Inji { |
||
12 | |||
13 | /** |
||
14 | * Static storage for core object |
||
15 | * |
||
16 | * @var Inji |
||
17 | */ |
||
18 | public static $inst = null; |
||
19 | |||
20 | /** |
||
21 | * Dynamic events listeners |
||
22 | * |
||
23 | * @var array |
||
24 | */ |
||
25 | private $_listeners = []; |
||
26 | |||
27 | /** |
||
28 | * Core config |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | public static $config = []; |
||
33 | |||
34 | /** |
||
35 | * Static storage for anything |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | public static $storage = []; |
||
40 | |||
41 | /** |
||
42 | * Stop executing code if this true after use Inji::$inst->stop() constuction in code |
||
43 | * |
||
44 | * @var boolean |
||
45 | */ |
||
46 | public $exitOnStop = true; |
||
47 | public $parallelLockFileStream = null; |
||
48 | |||
49 | /** |
||
50 | * Add event listener |
||
51 | * |
||
52 | * @param string $eventName |
||
53 | * @param string $listenCode |
||
54 | * @param array|string|closure $callback |
||
55 | * @param boolean $save |
||
56 | */ |
||
57 | 3 | public function listen($eventName, $listenCode, $callback, $save = false) { |
|
66 | |||
67 | /** |
||
68 | * Throw event |
||
69 | * |
||
70 | * @param string $eventName |
||
71 | * @param mixed $eventObject |
||
72 | * @return mixed |
||
73 | */ |
||
74 | 3 | public function event($eventName, $eventObject = null) { |
|
108 | |||
109 | /** |
||
110 | * Unlisten event |
||
111 | * |
||
112 | * @param string $eventName |
||
113 | * @param string $listenCode |
||
114 | * @param boolean $save |
||
115 | */ |
||
116 | 2 | public function unlisten($eventName, $listenCode, $save = false) { |
|
128 | |||
129 | public function stop() { |
||
135 | |||
136 | public function blockParallel() { |
||
143 | |||
144 | public function unBlockParallel() { |
||
150 | } |