Passed
Pull Request — master (#820)
by Maxim
16:07
created

EventDispatcher   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 2
c 1
b 0
f 0
dl 0
loc 10
ccs 3
cts 3
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A dispatch() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Events;
6
7
use Psr\EventDispatcher\EventDispatcherInterface;
8
use Spiral\Core\CoreInterface;
9
10
final class EventDispatcher implements EventDispatcherInterface
11
{
12 7
    public function __construct(
13
        private readonly CoreInterface $core
14
    ) {
15
    }
16
17 1
    public function dispatch(object $event): object
18
    {
19 1
        return $this->core->callAction($event::class, 'dispatch', ['event' => $event]);
20
    }
21
}
22