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

Core   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A callAction() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Events\Interceptor;
6
7
use Psr\EventDispatcher\EventDispatcherInterface;
8
use Spiral\Core\CoreInterface;
9
10
/**
11
 * @psalm-type TParameters = array{event: object}
12
 */
13
final class Core implements CoreInterface
14
{
15 7
    public function __construct(
16
        private readonly EventDispatcherInterface $dispatcher
17
    ) {
18
    }
19
20
    /**
21
     * @param string $controller event name
22
     * @param-assert TParameters $parameters
23
     */
24 1
    public function callAction(string $controller, string $action, array $parameters = []): object
25
    {
26 1
        \assert(\is_object($parameters['event']));
27
28 1
        return $this->dispatcher->dispatch($parameters['event']);
29
    }
30
}
31