Passed
Pull Request — master (#417)
by Alejandro
06:44
created

AsyncEventListener   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 6
c 0
b 0
f 0
dl 0
loc 16
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 3 1
A __construct() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Shlinkio\Shlink\EventDispatcher\Listener;
5
6
use Swoole\Http\Server as HttpServer;
7
8
class AsyncEventListener
9
{
10
    /** @var string */
11
    private $regularListenerName;
12
    /** @var HttpServer */
13
    private $server;
14
15 2
    public function __construct(HttpServer $server, string $regularListenerName)
16
    {
17 2
        $this->regularListenerName = $regularListenerName;
18 2
        $this->server = $server;
19
    }
20
21 1
    public function __invoke(object $event): void
22
    {
23 1
        $this->server->task(new EventListenerTask($this->regularListenerName, $event));
24
    }
25
}
26