Completed
Push — master ( bd4c27...8cd69a )
by GBProd
02:45 queued 37s
created

EventProviderTrait::popEvents()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
3
namespace GBProd\DomainEvent;
4
5
/**
6
 * Trait for event providers
7
 * 
8
 * @author gbprod <[email protected]>
9
 */
10
trait EventProviderTrait
11
{
12
    /**
13
     * @var array<DomainEvent>
14
     */
15
    private $events = [];
16
    
17
    /**
18
     * {inheritdoc}
19
     */
20 1
    public function raise(DomainEvent $event)
21
    {
22 1
        $this->events[] = $event;
23 1
    }
24
    
25
    /**
26
     * {inheritdoc}
27
     */
28 2
    public function popEvents()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
29
    {
30 2
        $events = $this->events;
31 2
        $this->events = [];
32
        
33 2
        return $events;
34
    }
35
}