Code Duplication    Length = 13-14 lines in 2 locations

src/Entity/ExchangeEntity.php 1 location

@@ 169-181 (lines=13) @@
166
     * @return mixed|void
167
     * @throws AMQPProtocolChannelException
168
     */
169
    public function publish(string $message, string $routingKey = '')
170
    {
171
        if ($this->attributes['auto_create'] === true) {
172
            $this->create();
173
            $this->bind();
174
        }
175
        $this->getChannel()->basic_publish(
176
            new AMQPMessage($message),
177
            $this->attributes['name'],
178
            $routingKey,
179
            true
180
        );
181
    }
182
}
183

src/Entity/QueueEntity.php 1 location

@@ 224-237 (lines=14) @@
221
     * @return mixed|void
222
     * @throws AMQPProtocolChannelException
223
     */
224
    public function publish(string $message, string $routingKey = '')
225
    {
226
        if ($this->attributes['auto_create'] === true) {
227
            $this->create();
228
            $this->bind();
229
        }
230
        $this->getChannel()
231
            ->basic_publish(
232
                new AMQPMessage($message),
233
                '',
234
                $this->attributes['name'],
235
                true
236
            );
237
    }
238
239
    /**
240
     * {@inheritdoc}