Code Duplication    Length = 16-16 lines in 2 locations

src/Commands/RabbitmqCommands.php 1 location

@@ 122-137 (lines=16) @@
119
   * @command rabbitmq:test-producer
120
   * @aliases rqtp
121
   */
122
  public function testProducer() {
123
    $connection = new AMQPStreamConnection(
124
      ConnectionFactory::DEFAULT_HOST,
125
      ConnectionFactory::DEFAULT_PORT,
126
      ConnectionFactory::DEFAULT_USER,
127
      ConnectionFactory::DEFAULT_PASS
128
    );
129
    $channel = $connection->channel();
130
    $routingKey = $queueName = 'hello';
131
    $channel->queue_declare($queueName, FALSE, FALSE, FALSE, FALSE);
132
    $message = new AMQPMessage('Hello World!');
133
    $channel->basic_publish($message, '', $routingKey);
134
    $this->writeln(" [x] Sent 'Hello World!'");
135
    $channel->close();
136
    $connection->close();
137
  }
138
139
  /**
140
   * Run the RabbitMQ tutorial test consumer.

rabbitmq.drush.inc 1 location

@@ 44-59 (lines=16) @@
41
/**
42
 * Command callback for rabbitmq-test-producer.
43
 */
44
function drush_rabbitmq_test_producer() {
45
  $connection = new AMQPStreamConnection(
46
    ConnectionFactory::DEFAULT_HOST,
47
    ConnectionFactory::DEFAULT_PORT,
48
    ConnectionFactory::DEFAULT_USER,
49
    ConnectionFactory::DEFAULT_PASS
50
  );
51
  $channel = $connection->channel();
52
  $routingKey = $queueName = 'hello';
53
  $channel->queue_declare($queueName, FALSE, FALSE, FALSE, FALSE);
54
  $message = new AMQPMessage('Hello World!');
55
  $channel->basic_publish($message, '', $routingKey);
56
  echo " [x] Sent 'Hello World!'\n";
57
  $channel->close();
58
  $connection->close();
59
}
60
61
/**
62
 * Command callback for rabbitmq-test-consumer.