Completed
Push — master ( be7a44...a89c67 )
by Filipe
01:07 queued 10s
created

EventGeneratorMethods::recordThat()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of slick/event package
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace Slick\Event\Domain;
11
12
use Slick\Event\Event;
13
14
/**
15
 * EventGeneratorMethods
16
 *
17
 * @package Slick\Event\Domain
18
 */
19
trait EventGeneratorMethods
20
{
21
22
    /**
23
     * @var Event[]
24
     */
25
    protected $events = [];
26
27
    /**
28
     * Record ane event that occurs
29
     *
30
     * @param Object $event
31
     */
32
    public function recordThat(Object $event): void
33
    {
34
        $this->events[] = $event;
35
    }
36
37
    /**
38
     * Releases all recorded events
39
     *
40
     * @return Event[]
41
     */
42
    public function releaseEvents(): array
43
    {
44
        $event = $this->events;
45
        $this->events = [];
46
        return $event;
47
    }
48
}
49