GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

EventsRegistry   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 28
ccs 10
cts 10
cp 1
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A expelRecordedEvents() 0 11 2
A triggeredA() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Dsantang\DomainEvents\Registry;
6
7
use Dsantang\DomainEvents\DomainEvent;
8
use Dsantang\DomainEvents\EventAware;
9
10
trait EventsRegistry
11
{
12
    /** @var DomainEvent[] */
13
    private $recordedEvents = [];
14
15
    /**
16
     * @return DomainEvent[]
17
     */
18 3
    public function expelRecordedEvents() : array
19
    {
20 3
        if ($this instanceof EventAware === false) {
21 1
            throw IncompatibleClass::forExpellingEvents($this);
22
        }
23
24 2
        $recordedEvents = $this->recordedEvents;
25
26 2
        $this->recordedEvents = [];
27
28 2
        return $recordedEvents;
29
    }
30
31 2
    private function triggeredA(DomainEvent $event) : void
32
    {
33 2
        if ($this instanceof EventAware === false) {
34 1
            throw IncompatibleClass::forTriggeringEvents($this);
35
        }
36
37 1
        $this->recordedEvents[] = $event;
38 1
    }
39
}
40