EventGeneratorMethods   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 28
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A releaseEvents() 0 5 1
A recordThat() 0 3 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