AbstractListener::sendNack()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 4
dl 0
loc 8
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Xervice\RabbitMQ\Business\Model\Worker\Listener;
5
6
7
use DataProvider\RabbitMqMessageDataProvider;
8
use PhpAmqpLib\Channel\AMQPChannel;
9
use Xervice\Core\Plugin\AbstractBusinessPlugin;
10
use Xervice\RabbitMQ\Business\Dependency\Worker\Listener\ListenerInterface;
11
12
abstract class AbstractListener extends AbstractBusinessPlugin implements ListenerInterface
13
{
14
    protected const DEFAULT_CHUNKSIZE = 100;
15
16
    /**
17
     * @return int
18
     */
19
    public function getChunkSize() : int
20
    {
21
        return self::DEFAULT_CHUNKSIZE;
22
    }
23
24
    /**
25
     * @param \PhpAmqpLib\Channel\AMQPChannel $channel
26
     * @param \DataProvider\RabbitMqMessageDataProvider $messageDataProvider
27
     */
28 2
    public function sendAck(
29
        AMQPChannel $channel,
30
        RabbitMqMessageDataProvider $messageDataProvider,
31
        bool $multiple = false
32
    ): void
33
    {
34 2
        $channel->basic_ack($messageDataProvider->getDeliveryTag(), $multiple);
35 2
    }
36
37
    /**
38
     * @param \PhpAmqpLib\Channel\AMQPChannel $channel
39
     * @param \DataProvider\RabbitMqMessageDataProvider $messageDataProvider
40
     */
41
    public function sendNack(
42
        AMQPChannel $channel,
43
        RabbitMqMessageDataProvider $messageDataProvider,
44
        bool $multiple = false,
45
        bool $requeue = true
46
    ): void
47
    {
48
        $channel->basic_nack($messageDataProvider->getDeliveryTag(), $multiple, $requeue);
49
    }
50
}