AggregateEventsTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 26
c 0
b 0
f 0
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A raise() 0 4 1
A pullEvents() 0 7 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
10
namespace GpsLab\Domain\Event\Aggregator;
11
12
use GpsLab\Domain\Event\Event;
13
14
trait AggregateEventsTrait
15
{
16
    /**
17
     * @var Event[]
18
     */
19
    private $events = [];
20
21
    /**
22
     * @param Event $event
23
     */
24 1
    protected function raise(Event $event)
25
    {
26 1
        $this->events[] = $event;
27 1
    }
28
29
    /**
30
     * @return Event[]
31
     */
32 1
    public function pullEvents()
33
    {
34 1
        $events = $this->events;
35 1
        $this->events = [];
36
37 1
        return $events;
38
    }
39
}
40