1 | <?php |
||
13 | class Registry |
||
14 | { |
||
15 | /** |
||
16 | * @var array<Factory> |
||
17 | */ |
||
18 | private $factories = []; |
||
19 | |||
20 | /** |
||
21 | * Register a Factory |
||
22 | * |
||
23 | * @param string classname Fully qualified classname of the handled specification |
||
24 | * @param Factory $factory |
||
25 | */ |
||
26 | 7 | public function register($classname, Factory $factory) |
|
30 | |||
31 | /** |
||
32 | * Get registred Factory for Specification |
||
33 | * |
||
34 | * @param Specification $spec |
||
35 | * |
||
36 | * @return Factory |
||
37 | * |
||
38 | * @throw OutOfRangeException if Factory not found |
||
39 | */ |
||
40 | 8 | public function getFactory(Specification $spec) |
|
51 | } |
||
52 |