src/Driver/DriverFactory.php
public static function getDriver($connection)
    {
        if (is_array($connection) &&
            isset($connection['host'], $connection['port'], $connection['user'], $connection['pwd'])
        ) {
            $connection = self::getConnectionFromArray($connection);
        }

        if ($connection instanceof AbstractConnection) {
            return new PhpAmqpLibDriver($connection);
        }

        if ($connection instanceof \AMQPConnection) {
            return new PeclAmqpDriver($connection);
        }

        throw new \InvalidArgumentException('You provided an unsupported connection');
    }
public static function getDriver($connection)
    {
        if (is_array($connection) &&
            isset($connection['host'], $connection['port'], $connection['user'], $connection['pwd'])
        ) {
            $connection = self::getConnectionFromArray($connection);
        }

        if ($connection instanceof AbstractConnection) {
            return new PhpAmqpLibDriver($connection);
        }

        if ($connection instanceof \AMQPConnection) {
            return new PeclAmqpDriver($connection);
        }

        throw new \InvalidArgumentException('You provided an unsupported connection');
    }
Return the driver for your system

It accepts a PECL connection, a PhpAmqpLib connection or an array following
the following schema :
[
'host' => '<hostValue>',
'port' => '<portValue>',
'user' => '<userValue>',
'pwd'  => '<pwdValue>'
]

If you provide an array, the PECL extension has precedence over the PhpAmqpLib.

@param $connection

@return Driver

@throws \AMQPConnectionException
@throws \InvalidArgumentException