Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
23 | 2 | public function factory(string $name, array $config) |
|
24 | { |
||
25 | 2 | if (isset($this->messagePublisher[$name])) { |
|
26 | 1 | return $this->messagePublisher[$name]; |
|
27 | } |
||
28 | |||
29 | 2 | if ('amqp_lib' === $config['client']) { |
|
30 | /** @var $connexion AMQPStreamConnection */ |
||
31 | 1 | $connexion = $this->container->get($config['connexion'] ?? 'darkilliant_mqprocess_connection'); |
|
32 | |||
33 | 1 | return $this->messagePublisher[$name] = new AmqpMessagePublisher( |
|
34 | 1 | $connexion->channel(), |
|
35 | 1 | $config['queue'], |
|
36 | 1 | $config['exchange'], |
|
37 | 1 | $config['persistant'] |
|
38 | ); |
||
39 | } |
||
40 | |||
41 | 1 | return null; |
|
42 | } |
||
44 |