ResetServices   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 14
ccs 5
cts 5
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A receive() 0 6 1
A __construct() 0 2 1
1
<?php
2
3
namespace Bdf\QueueBundle\Consumption\Receiver;
4
5
use Bdf\Queue\Consumer\ConsumerInterface;
6
use Bdf\Queue\Consumer\DelegateHelper;
7
use Bdf\Queue\Consumer\ReceiverInterface;
8
use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter;
9
10
/**
11
 * Reset all services registered on "kernel.reset".
12
 */
13
class ResetServices implements ReceiverInterface
14
{
15
    use DelegateHelper;
16
17 5
    public function __construct(private ServicesResetter $servicesResetter)
18
    {
19 5
    }
20
21 2
    public function receive($message, ConsumerInterface $next): void
22
    {
23
        try {
24 2
            $next->receive($message, $next);
0 ignored issues
show
Bug introduced by
The method receive() does not exist on Bdf\Queue\Consumer\ConsumerInterface. It seems like you code against a sub-type of Bdf\Queue\Consumer\ConsumerInterface such as Bdf\Queue\Consumer\Receiver\NextInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
            $next->/** @scrutinizer ignore-call */ 
25
                   receive($message, $next);
Loading history...
25
        } finally {
26 2
            $this->servicesResetter->reset();
27
        }
28
    }
29
}
30