1 | <?php |
||
7 | class ConnectionRegistry |
||
8 | { |
||
9 | /** |
||
10 | * @var AbstractConnection[] |
||
11 | */ |
||
12 | protected $connections; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $defaultConnection; |
||
18 | |||
19 | /** |
||
20 | * ConnectionRegistry constructor. |
||
21 | * |
||
22 | * @param AbstractConnection[] $connections Array of connections. |
||
23 | * @param string $defaultConnection Key of default connection. |
||
24 | */ |
||
25 | 15 | public function __construct(array $connections, $defaultConnection) |
|
30 | |||
31 | /** |
||
32 | * Return a connection. |
||
33 | * |
||
34 | * @param string $name Key of connection to get. |
||
35 | * @return AbstractConnection |
||
36 | */ |
||
37 | 15 | public function getConnection($name = null) |
|
49 | |||
50 | /** |
||
51 | * Add connection to connections registry. |
||
52 | * |
||
53 | * @param string $name Key for connection. |
||
54 | * @param AbstractConnection $connection Connection object. |
||
55 | */ |
||
56 | 5 | public function addConnection($name, AbstractConnection $connection) |
|
60 | } |
||
61 |