Completed
Push — master ( de5c9f...2ef464 )
by Daniel
21s queued 11s
created

AmqpMessageFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 4
c 1
b 0
f 1
dl 0
loc 19
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 3 1
A getDefaultProperties() 0 4 1
1
<?php
2
3
namespace Jellyfish\QueueRabbitMq;
4
5
use PhpAmqpLib\Message\AMQPMessage;
6
7
class AmqpMessageFactory implements AmqpMessageFactoryInterface
8
{
9
    /**
10
     * @param string $body
11
     *
12
     * @return \PhpAmqpLib\Message\AMQPMessage
13
     */
14
    public function create(string $body): AMQPMessage
15
    {
16
        return new AMQPMessage($body, $this->getDefaultProperties());
17
    }
18
19
    /**
20
     * @return array
21
     */
22
    protected function getDefaultProperties(): array
23
    {
24
        return [
25
            'delivery_mode' => AMQPMessage::DELIVERY_MODE_PERSISTENT
26
        ];
27
    }
28
}
29