Passed
Branch master (74fab5)
by Kunal
03:19
created

RabbitMQGenericMessageConsumer::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
c 1
b 0
f 1
nc 1
nop 3
dl 0
loc 5
rs 10
1
<?php
2
3
namespace Kunnu\RabbitMQ;
4
5
use Closure;
6
7
class RabbitMQGenericMessageConsumer extends RabbitMQMessageConsumer
8
{
9
    protected $scope;
10
    protected Closure $handler;
11
12
    public function __construct(Closure $handler, $scope, array $config = [])
13
    {
14
        parent::__construct($config);
15
        $this->handler = $handler;
16
        $this->scope = $scope;
17
    }
18
19
    public function handle(RabbitMQIncomingMessage $message): void
20
    {
21
        $this->handler->call($this->scope, $message);
22
    }
23
}
24