private static function build(
        $host,
        $port,
        $user,
        $pass,
        $exchangeName,
        $sync,
        $escapeMode,
        $timeout
    ) {
        $driver = DriverFactory::getDriver([
            'host' => $host,
            'port' => $port,
            'user' => $user,
            'pwd'  => $pass
        ]);

        $publisher = ($sync) ?
            new SyncPublisher($driver, $exchangeName, $timeout):
            new AsyncPublisher($driver, $exchangeName);

        if ($escapeMode === self::ESCAPE_MODE_NONE) {
            return $publisher;
        }

        if ($escapeMode === self::ESCAPE_MODE_JSON) {
            return new SerializingPublisher($publisher, new JsonSerializer());
        }

        if ($escapeMode === self::ESCAPE_MODE_SERIALIZE) {
            return new SerializingPublisher($publisher, new PhpSerializer());
        }

        throw new \InvalidArgumentException('Bad serializer name');
    }
private static function build(
        $host,
        $port,
        $user,
        $pass,
        $exchangeName,
        $sync,
        $escapeMode,
        $timeout
    ) {
        $driver = DriverFactory::getDriver([
            'host' => $host,
            'port' => $port,
            'user' => $user,
            'pwd'  => $pass
        ]);

        $publisher = ($sync) ?
            new SyncPublisher($driver, $exchangeName, $timeout):
            new AsyncPublisher($driver, $exchangeName);

        if ($escapeMode === self::ESCAPE_MODE_NONE) {
            return $publisher;
        }

        if ($escapeMode === self::ESCAPE_MODE_JSON) {
            return new SerializingPublisher($publisher, new JsonSerializer());
        }

        if ($escapeMode === self::ESCAPE_MODE_SERIALIZE) {
            return new SerializingPublisher($publisher, new PhpSerializer());
        }

        throw new \InvalidArgumentException('Bad serializer name');
    }
private static function build ( $ host , $ port , $ user , $ pass , $ exchangeName , $ sync , $ escapeMode , $ timeout ) { $ driver = DriverFactory :: getDriver ( [ 'host' => $ host , 'port' => $ port , 'user' => $ user , 'pwd' => $ pass ] ) ; $ publisher = ( $ sync ) ? new SyncPublisher ( $ driver , $ exchangeName , $ timeout ) : new AsyncPublisher ( $ driver , $ exchangeName ) ; if ( $ escapeMode === self :: ESCAPE_MODE_NONE ) { return $ publisher ; } if ( $ escapeMode === self :: ESCAPE_MODE_JSON ) { return new SerializingPublisher ( $ publisher , new JsonSerializer ( ) ) ; } if ( $ escapeMode === self :: ESCAPE_MODE_SERIALIZE ) { return new SerializingPublisher ( $ publisher , new PhpSerializer ( ) ) ; } throw new \ InvalidArgumentException ( 'Bad serializer name' ) ; }
Build a publisher

@param string $host
@param string $port
@param string $user
@param string $pass
@param string $exchangeName
@param bool   $sync
@param string $escapeMode
@param int    $timeout

@return QueuePublisher
Build a publisher