protected function getConnections(array $config)
{
if (!isset($config['connections'])) {
throw new \RuntimeException('Configuration must contain a "connections" key');
}
if (!is_array($config['connections']) || !$config['connections']) {
throw new \RuntimeException('Configuration "connections" key must reference a non-empty array');
}
$connections = array_filter($config['connections'], function ($connection) {
return $connection instanceof ConnectionInterface;
});
if (count($connections) != count($config['connections'])) {
throw new \RuntimeException('All configuration "connections" array values must implement \\Phergie\\Irc\\ConnectionInterface');
}
return $connections;
}