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 ( 0a5333...b8c872 )
by Cees-Jan
12s queued 11s
created

Factory::limitedPool()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php declare(strict_types=1);
2
3
namespace ReactParallel;
4
5
use Closure;
6
use React\EventLoop\LoopInterface;
7
use React\Promise\PromiseInterface;
8
use ReactParallel\FutureToPromiseConverter\FutureToPromiseConverter;
9
use ReactParallel\Pool\Infinite\Infinite;
10
use ReactParallel\Pool\Limited\Limited;
11
use ReactParallel\Runtime\Runtime;
12
use const WyriHaximus\Constants\Numeric\ONE;
13
14
final class Factory
15
{
16 3
    public static function futureToPromiseConverter(LoopInterface $loop): FutureToPromiseConverter
17
    {
18 3
        return new FutureToPromiseConverter($loop);
19
    }
20
21
    /**
22
     * @param mixed[] $args
23
     */
24 1
    public static function call(LoopInterface $loop, Closure $closure, array $args = []): PromiseInterface
25
    {
26 1
        $runtime = Runtime::create(self::futureToPromiseConverter($loop));
27
28
        /**
29
         * @psalm-suppress UndefinedInterfaceMethod
30
         */
31
        return $runtime->run($closure, $args)->always(static function () use ($runtime): void {
32 1
            $runtime->close();
33 1
        });
34
    }
35
36 1
    public static function infinitePool(LoopInterface $loop): Infinite
37
    {
38 1
        return new Infinite($loop, ONE);
39
    }
40
41 1
    public static function limitedPool(LoopInterface $loop, int $threadCount): Limited
42
    {
43 1
        return Limited::create($loop, $threadCount);
44
    }
45
}
46