1 | <?php |
||
10 | class Manager |
||
11 | { |
||
12 | /** @var \Wandu\Database\Manager */ |
||
13 | protected static $instance; |
||
14 | |||
15 | /** @var \ArrayAccess */ |
||
16 | protected $container; |
||
17 | |||
18 | /** @var array */ |
||
19 | protected $connections = []; |
||
20 | |||
21 | /** |
||
22 | * @param \ArrayAccess $container |
||
23 | */ |
||
24 | 2 | public function __construct(ArrayAccess $container = null) |
|
28 | |||
29 | /** |
||
30 | * @param array|\Wandu\Database\Contracts\ConnectorInterface $information |
||
31 | * @param string $name |
||
32 | * @return \Wandu\Database\Contracts\ConnectionInterface |
||
33 | */ |
||
34 | 2 | public function connect($information, $name = 'default') |
|
41 | |||
42 | /** |
||
43 | * @param \Wandu\Database\Contracts\ConnectionInterface $connection |
||
44 | * @param string $name |
||
45 | * @return \Wandu\Database\Contracts\ConnectionInterface |
||
46 | */ |
||
47 | 1 | public function connection(ConnectionInterface $connection, $name = 'default') |
|
48 | { |
||
49 | 1 | return $this->connections[$name] = $connection; |
|
50 | } |
||
51 | |||
52 | /** |
||
53 | * @return \Wandu\Database\Manager |
||
54 | */ |
||
55 | public function setAsGlobal() |
||
61 | |||
62 | /** |
||
63 | * @param array $config |
||
64 | * @return \Wandu\Database\Contracts\ConnectorInterface |
||
65 | */ |
||
66 | 2 | private function getConnectorFromConfig(array $config) |
|
77 | } |
||
78 |