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

EventDispatcher   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 25%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 33
ccs 3
cts 12
cp 0.25
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A callListener() 0 4 1
A canBeCalled() 0 4 1
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
}