GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 300375...e1d914 )
by Cees-Jan
12s
created

Factory   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Test Coverage

Coverage 96%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 0
cbo 7
dl 0
loc 52
ccs 24
cts 25
cp 0.96
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 20 1
B gatherMapping() 0 28 4
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Tools\CommandBus;
4
5
use Composed\Package;
6
use function Composed\packages;
7
use function igorw\get_in;
8
use League\Tactician\Container\ContainerLocator;
9
use League\Tactician\Handler\CommandHandlerMiddleware;
10
use League\Tactician\Handler\CommandNameExtractor\ClassNameExtractor;
11
use League\Tactician\Handler\MethodNameInflector\HandleInflector;
12
use Psr\Container\ContainerInterface;
13
use React\EventLoop\LoopInterface;
14
use WyriHaximus\Tactician\CommandHandler\Mapper;
15
16
final class Factory
17
{
18 1
    public static function create(ContainerInterface $container)
19
    {
20 1
        $commandToHandlerMap = self::gatherMapping();
21
22 1
        $containerLocator = new ContainerLocator(
23 1
            $container,
0 ignored issues
show
Compatibility introduced by
$container of type object<Psr\Container\ContainerInterface> is not a sub-type of object<Interop\Container\ContainerInterface>. It seems like you assume a child interface of the interface Psr\Container\ContainerInterface to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
24 1
            $commandToHandlerMap
25
        );
26
27 1
        $commandHandlerMiddleware = new CommandHandlerMiddleware(
28 1
            new ClassNameExtractor(),
29 1
            $containerLocator,
30 1
            new HandleInflector()
31
        );
32
33 1
        return new CommandBus(
34 1
            $container->get(LoopInterface::class),
35 1
            $commandHandlerMiddleware
36
        );
37
    }
38
39 1
    private static function gatherMapping()
40
    {
41 1
        $map = [];
42
        /** @var Package $package */
43 1
        foreach (packages() as $package) {
44 1
            $config = $package->getConfig('extra');
45
46 1
            if ($config === null) {
47 1
                continue;
48
            }
49
50 1
            $mapping = get_in(
51 1
                $config,
52
                [
53 1
                    'api-clients',
54
                    'command-bus'
55
                ]
56
            );
57
58 1
            if ($mapping === null) {
59 1
                continue;
60
            }
61
62
            $map += Mapper::map($package->getPath($mapping['path']), $mapping['namespace']);
63
        }
64
65 1
        return $map;
66
    }
67
}
68