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

RabbitMQGenericMessageConsumer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A handle() 0 3 1
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