| Conditions | 5 |
| Paths | 6 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function __construct(array $configs) |
||
| 16 | { |
||
| 17 | foreach ($configs as $name => $config) { |
||
| 18 | if (isset($config['dsn'])) { |
||
| 19 | $config = array_merge($config, parse_url($config['dsn'])); |
||
| 20 | if (isset($config['pass'])) { |
||
| 21 | $config['password'] = $config['pass']; |
||
| 22 | // Cleanup |
||
| 23 | unset($config['pass']); |
||
| 24 | } |
||
| 25 | if (isset($config['path'])) { |
||
| 26 | $config['vhost'] = urldecode(substr($config['path'], 1)); |
||
| 27 | // Cleanup |
||
| 28 | unset($config['path']); |
||
| 29 | } |
||
| 30 | } |
||
| 31 | |||
| 32 | $check = new RabbitMQ($config['host'], $config['port'], $config['user'], $config['password'], $config['vhost']); |
||
| 33 | $check->setLabel(sprintf('Rabbit MQ "%s"', $name)); |
||
| 34 | |||
| 35 | $this->checks[sprintf('rabbit_mq_%s', $name)] = $check; |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 47 |