Passed
Push — master ( a4ffc4...615af5 )
by Alexander
03:23
created

EventDispatcherInterfaceProxy::dispatch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Debug\Proxy;
6
7
use Psr\EventDispatcher\EventDispatcherInterface;
8
use Yiisoft\Yii\Debug\Collector\EventCollectorInterface;
9
10
final class EventDispatcherInterfaceProxy implements EventDispatcherInterface
11
{
12
    public function __construct(
13
        private EventDispatcherInterface $dispatcher,
14
        private EventCollectorInterface $collector
15
    ) {
16
    }
17
18 1
    public function dispatch(object $event): object
19
    {
20 1
        [$callStack] = debug_backtrace();
21
22 1
        $this->collector->collect($event, $callStack['file'] . ':' . $callStack['line']);
23
24 1
        return $this->dispatcher->dispatch($event);
25
    }
26
}
27