Total Complexity | 6 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class Worker { |
||
9 | /** |
||
10 | * @var GlobalContainer $gc |
||
11 | */ |
||
12 | protected $gc; |
||
13 | |||
14 | /** |
||
15 | * @var callable[] $workers |
||
16 | */ |
||
17 | protected $workers = []; |
||
18 | |||
19 | /** |
||
20 | * Detaches script from incoming request |
||
21 | * |
||
22 | * Calling side is released and script continues it's execution |
||
23 | */ |
||
24 | public static function detachIncomingRequest() { |
||
34 | |||
35 | } |
||
36 | |||
37 | public function __construct(GlobalContainer $gc) { |
||
38 | $this->gc = $gc; |
||
39 | } |
||
40 | |||
41 | public function __call($name, $arguments) { |
||
42 | $result = null; |
||
43 | if (!empty($this->workers[$name]) && is_callable($this->workers[$name])) { |
||
44 | $result = call_user_func_array($this->workers[$name], $arguments); |
||
45 | } |
||
46 | |||
47 | return $result; |
||
48 | } |
||
49 | |||
50 | public function registerWorker($name, $callable) { |
||
54 | } |
||
55 | |||
56 | } |
||
57 |