Passed
Push — master ( 823aee...b9b37f )
by Alec
13:15 queued 12s
created

ReactLoopProbe   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 2
c 0
b 0
f 0
dl 0
loc 10
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A isSupported() 0 3 1
A createLoop() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
// 17.02.23
5
6
namespace AlecRabbit\Spinner\Asynchronous\Loop\Probe;
7
8
use AlecRabbit\Spinner\Asynchronous\Loop\Adapter\ReactLoopAdapter;
9
use AlecRabbit\Spinner\Asynchronous\Loop\Probe\A\ALoopProbe;
10
use AlecRabbit\Spinner\Core\Contract\ILoopAdapter;
11
use React\EventLoop\Loop;
12
13
use function class_exists;
14
15
class ReactLoopProbe extends ALoopProbe
16
{
17
    public static function isSupported(): bool
18
    {
19
        return class_exists(Loop::class);
20
    }
21
22
    public static function createLoop(): ILoopAdapter
23
    {
24
        return new ReactLoopAdapter(Loop::get());
25
    }
26
}
27