1 | <?php |
||
15 | class Registry |
||
16 | { |
||
17 | /** |
||
18 | * @var array<Factory> |
||
19 | */ |
||
20 | private $factories = array(); |
||
21 | |||
22 | /** |
||
23 | * Register a factory |
||
24 | * |
||
25 | * @param string classname Fully qualified classname of the handled specification |
||
26 | * @param Factory $factory |
||
27 | */ |
||
28 | 10 | public function register($classname, Factory $factory) |
|
32 | |||
33 | /** |
||
34 | * Get registred factory for Specification |
||
35 | * |
||
36 | * @param Specification $spec |
||
37 | * |
||
38 | * @return Factory |
||
39 | * |
||
40 | * @throw OutOfRangeException if Factory not found |
||
41 | */ |
||
42 | 11 | public function getFactory(Specification $spec): Factory |
|
53 | } |
||
54 |