1 | <?php |
||
14 | class DriverManager |
||
15 | { |
||
16 | protected $container; |
||
17 | |||
18 | /** @var Driver[] */ |
||
19 | protected $drivers = []; |
||
20 | |||
21 | /** @var array */ |
||
22 | protected $parameters = []; |
||
23 | |||
24 | 4 | public function __construct(ContainerInterface $container) |
|
28 | |||
29 | /** |
||
30 | * Add driver. |
||
31 | * |
||
32 | * @param Driver $driver |
||
33 | * @param string $name |
||
34 | * @param array $parameters |
||
35 | */ |
||
36 | 3 | public function add(Driver $driver, string $name, array $parameters): void |
|
41 | |||
42 | /** |
||
43 | * Get driver for channel. |
||
44 | * |
||
45 | * @param Channel $channel |
||
46 | * |
||
47 | * @param ServerRequestInterface $request |
||
48 | * |
||
49 | * @return Driver |
||
50 | * @throws DriverNotFound |
||
51 | */ |
||
52 | 3 | public function get(Channel $channel, ServerRequestInterface $request): Driver |
|
66 | |||
67 | /** |
||
68 | * Get all added drivers. |
||
69 | * |
||
70 | * @return array |
||
71 | */ |
||
72 | 1 | public function all(): array |
|
76 | |||
77 | /** |
||
78 | * Validate channel parameters with driver requirements. |
||
79 | * |
||
80 | * @param Channel $channel |
||
81 | */ |
||
82 | 2 | protected function validateParameters(Channel $channel): void |
|
93 | } |
||
94 |