Total Complexity | 6 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
13 | final class Stats |
||
14 | { |
||
15 | /** |
||
16 | * actions |
||
17 | */ |
||
18 | public const PROPOSED = 0x1; |
||
19 | public const CONFIRMED = 0x2; |
||
20 | |||
21 | /** |
||
22 | * @var int |
||
23 | */ |
||
24 | private static $pending = 0; |
||
25 | |||
26 | /** |
||
27 | * @var Closure |
||
28 | */ |
||
29 | private static $observer = null; |
||
30 | |||
31 | /** |
||
32 | * @return int |
||
33 | */ |
||
34 | public static function pending() : int |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @param Closure $set |
||
41 | */ |
||
42 | public static function hooking(?Closure $set) : void |
||
43 | { |
||
44 | self::$observer = $set; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param Promised $ins |
||
49 | */ |
||
50 | public static function proposed(Promised $ins) : void |
||
51 | { |
||
52 | self::$pending++; |
||
53 | self::$observer && (self::$observer)(self::PROPOSED, $ins); |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * @param Promised $ins |
||
58 | */ |
||
59 | public static function confirmed(Promised $ins) : void |
||
63 | } |
||
64 | } |
||
65 |