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 ( 878d0b...bf5c8f )
by Cees-Jan
01:53
created

TestCase   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 11

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 11
dl 0
loc 29
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A hydrate() 0 12 1
A createCommandBus() 0 13 1
1
<?php
2
declare(strict_types=1);
3
4
namespace ApiClients\Tools\ResourceTestUtilities;
5
6
use ApiClients\Foundation\Hydrator\Factory;
7
use ApiClients\Foundation\Hydrator\Options;
8
use ApiClients\Tools\CommandBus\CommandBus;
9
use ApiClients\Tools\TestUtilities\TestCase as BaseTestCase;
10
use DI\ContainerBuilder;
11
use League\Tactician\Handler\CommandHandlerMiddleware;
12
use League\Tactician\Handler\CommandNameExtractor\ClassNameExtractor;
13
use League\Tactician\Handler\Locator\InMemoryLocator;
14
use League\Tactician\Handler\MethodNameInflector\HandleInflector;
15
use React\EventLoop\Factory as LoopFactory;
16
use React\EventLoop\LoopInterface;
17
18
abstract class TestCase extends BaseTestCase
19
{
20
    public function hydrate($class, $json, $namespace)
21
    {
22
        $loop = LoopFactory::create();
23
        $container = ContainerBuilder::buildDevContainer();
24
        $container->set(CommandBus::class, $this->createCommandBus($loop));
25
        return Factory::create($container, [
26
            Options::NAMESPACE => '',
27
            Options::NAMESPACE_SUFFIX => $namespace,
28
            Options::RESOURCE_CACHE_DIR => $this->getTmpDir(),
29
            Options::RESOURCE_NAMESPACE => $this->getRandomNameSpace(),
30
        ])->hydrateFQCN($class, $json);
31
    }
32
33
    protected function createCommandBus(LoopInterface $loop, array $map = []): CommandBus
34
    {
35
        $commandHandlerMiddleware = new CommandHandlerMiddleware(
36
            new ClassNameExtractor(),
37
            new InMemoryLocator($map),
38
            new HandleInflector()
39
        );
40
41
        return new CommandBus(
42
            $loop,
43
            $commandHandlerMiddleware
44
        );
45
    }
46
}
47