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

Core::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
c 1
b 0
f 0
dl 0
loc 3
ccs 1
cts 1
cp 1
rs 10
cc 1
nc 1
nop 1
crap 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