DispatchEventTrait::dispatchEvent()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
ccs 4
cts 4
cp 1
rs 9.4285
cc 2
eloc 3
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Vox\Webservice\Event;
4
5
use Vox\Webservice\EventDispatcherInterface;
6
7
trait DispatchEventTrait
8
{
9
    /**
10
     * @var EventDispatcherInterface
11
     */
12
    private $eventDispatcher;
13
    
14 18
    private function dispatchEvent(string $event, EventInterface $context = null)
15
    {
16 18
        if (!$this->eventDispatcher) {
17 16
            return;
18
        }
19
        
20 2
        $this->eventDispatcher->dispatch($event, $context);
21 2
    }
22
}
23