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::rmdir()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 21
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 5.246

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 11
cts 14
cp 0.7856
rs 8.7624
c 0
b 0
f 0
cc 5
eloc 13
nc 5
nop 1
crap 5.246
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