Passed
Push — master ( a1b0a5...d00cde )
by Alexey
02:47
created

EventDispatcher::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.0156

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 4
cp 0.75
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1.0156
1
<?php declare(strict_types = 1);
2
3
namespace Venta\Framework\Event;
4
5
use Venta\Contracts\Container\Container;
6
use Venta\Contracts\Event\Event as EventContract;
7
use Venta\Event\EventDispatcher as BaseEventDispatcher;
8
9
/**
10
 * Class EventDispatcher
11
 *
12
 * @package Venta\Framework
13
 */
14
class EventDispatcher extends BaseEventDispatcher
15
{
16
    /**
17
     * @var Container
18
     */
19
    private $container;
20
21
    /**
22
     * CommandCollector constructor.
23
     *
24
     * @param Container $container
25
     */
26 1
    public function __construct(Container $container)
27
    {
28 1
        $this->container = $container;
29 1
    }
30
31
    /**
32
     * @inheritDoc
33
     */
34
    protected function callListener($listener, EventContract $event)
35
    {
36
        $this->container->call($listener, [$event]);
37
    }
38
39
    /**
40
     * @inheritDoc
41
     */
42
    protected function canBeCalled($listener): bool
43
    {
44
        return $this->container->isCallable($listener);
45
    }
46
}