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::getRandomNameSpace()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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