Completed
Push — master ( fcbd63...720fe1 )
by Peter
03:37
created

AggregateEventsTrait::raise()   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

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * GpsLab component.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2016, Peter Gribanov
7
 * @license   http://opensource.org/licenses/MIT
8
 */
9
namespace GpsLab\Domain\Event\Aggregator;
10
11
use GpsLab\Domain\Event\EventInterface;
12
13
trait AggregateEventsTrait
14
{
15
    /**
16
     * @var EventInterface[]
17
     */
18
    private $events = [];
19
20
    /**
21
     * @return EventInterface[]
22
     */
23 1
    public function pullEvents()
24
    {
25 1
        $events = $this->events;
26 1
        $this->events = [];
27
28 1
        return $events;
29
    }
30
31
    /**
32
     * @param EventInterface $event
33
     */
34 1
    protected function raise(EventInterface $event)
35
    {
36 1
        $this->events[] = $event;
37 1
    }
38
}
39