ResetServicesFactory   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getReceiverNames() 0 3 1
A create() 0 7 3
1
<?php
2
3
namespace Bdf\QueueBundle\Consumption\Receiver;
4
5
use Bdf\Queue\Consumer\Receiver\Builder\ReceiverFactory;
6
use Bdf\Queue\Consumer\ReceiverInterface;
7
use Bdf\QueueBundle\Consumption\ReceiverFactoryInterface;
8
use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter;
9
10
class ResetServicesFactory implements ReceiverFactoryInterface
11
{
12 10
    public function getReceiverNames(): array
13
    {
14 10
        return ['reset'];
15
    }
16
17 5
    public function create(ReceiverFactory $factory, ...$arguments): ReceiverInterface
18
    {
19 5
        if (!isset($arguments[0]) || !($arguments[0] instanceof ServicesResetter)) {
20 1
            throw new \LogicException(sprintf('First argument of %s should be an instance of %s.', ResetServices::class, ServicesResetter::class));
21
        }
22
23 4
        return new ResetServices($arguments[0]);
24
    }
25
}
26