Code Duplication    Length = 13-14 lines in 2 locations

src/Entity/ExchangeEntity.php 1 location

@@ 187-199 (lines=13) @@
184
     * @return mixed|void
185
     * @throws AMQPProtocolChannelException
186
     */
187
    public function publish(string $message, string $routingKey = '')
188
    {
189
        if ($this->attributes['auto_create'] === true) {
190
            $this->create();
191
            $this->bind();
192
        }
193
        $this->getChannel()->basic_publish(
194
            new AMQPMessage($message),
195
            $this->attributes['name'],
196
            $routingKey,
197
            true
198
        );
199
    }
200
}
201

src/Entity/QueueEntity.php 1 location

@@ 243-256 (lines=14) @@
240
     * @return mixed|void
241
     * @throws AMQPProtocolChannelException
242
     */
243
    public function publish(string $message, string $routingKey = '')
244
    {
245
        if ($this->attributes['auto_create'] === true) {
246
            $this->create();
247
            $this->bind();
248
        }
249
        $this->getChannel()
250
            ->basic_publish(
251
                new AMQPMessage($message),
252
                '',
253
                $this->attributes['name'],
254
                true
255
            );
256
    }
257
258
    /**
259
     * {@inheritdoc}