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.

TestCase   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 9

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 9
dl 0
loc 29
ccs 0
cts 15
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\CommandBus\CommandBusInterface;
10
use ApiClients\Tools\TestUtilities\TestCase as BaseTestCase;
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, $namespaceSuffix)
21
    {
22
        $loop = LoopFactory::create();
23
        $commandBus = $this->createCommandBus($loop);
24
25
        return Factory::create($loop, $commandBus, [
26
            Options::NAMESPACE => $namespace,
27
            Options::NAMESPACE_SUFFIX => $namespaceSuffix,
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 = []): CommandBusInterface
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