Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public function getConnection($name = null) |
||
20 | { |
||
21 | $factory = $this->getContainer()->get($this->factories['default']); |
||
22 | |||
23 | if (!is_null($name) && array_key_exists($name, $this->factories)) { |
||
24 | $factory = $this->getContainer()->get( |
||
25 | $this->factories[$name] |
||
26 | ); |
||
27 | } |
||
28 | |||
29 | if (!$factory instanceof ConnectionFactory) { |
||
30 | throw new NotFoundAMQPConnectionFactoryException(sprintf('%s: connection not found.', $name)); |
||
31 | } |
||
32 | |||
33 | return $factory->createConnection(); |
||
34 | } |
||
35 | |||
44 |