1 | <?php |
||
11 | class AsyncTableRegistry implements PoolUtilizerInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var AsyncTable[] |
||
15 | */ |
||
16 | protected static $tables = []; |
||
17 | |||
18 | /** |
||
19 | * @var AsyncTableRegistry |
||
20 | */ |
||
21 | protected static $instance = null; |
||
22 | |||
23 | /** |
||
24 | * @var boolean |
||
25 | */ |
||
26 | protected static $reset = false; |
||
27 | |||
28 | /** |
||
29 | * @param LoopInterface $loop |
||
30 | * @param array $config |
||
31 | */ |
||
32 | public static function init(LoopInterface $loop, array $config = []) |
||
36 | |||
37 | /** |
||
38 | * @param Table $table |
||
39 | * |
||
40 | * @return AsyncTable |
||
|
|||
41 | */ |
||
42 | public static function get(Table $table) |
||
67 | |||
68 | 3 | public static function getInstance() |
|
77 | |||
78 | 25 | public static function reset() |
|
82 | |||
83 | /** |
||
84 | * @inheritDoc |
||
85 | */ |
||
86 | public function info() |
||
90 | } |
||
91 |
In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.
If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.