1 | <?php |
||
10 | class AsyncTableRegistry implements PoolUtilizerInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var AsyncTable[] |
||
14 | */ |
||
15 | protected static $tables = []; |
||
16 | |||
17 | /** |
||
18 | * @var AsyncTableRegistry |
||
19 | */ |
||
20 | protected static $instance = null; |
||
21 | |||
22 | /** |
||
23 | * @var boolean |
||
24 | */ |
||
25 | protected static $reset = false; |
||
26 | |||
27 | /** |
||
28 | * @param LoopInterface $loop |
||
29 | * @param array $config |
||
30 | */ |
||
31 | public static function init(LoopInterface $loop, array $config = []) |
||
35 | |||
36 | /** |
||
37 | * @param Table $table |
||
38 | * |
||
39 | * @return AsyncTable |
||
|
|||
40 | */ |
||
41 | public static function get(Table $table) |
||
64 | |||
65 | 3 | public static function getInstance() |
|
74 | |||
75 | 25 | public static function reset() |
|
79 | |||
80 | /** |
||
81 | * @inheritDoc |
||
82 | */ |
||
83 | public function info() |
||
87 | } |
||
88 |
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.