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.
Passed
Pull Request — master (#5)
by Giacomo
03:22 queued 01:34
created

OrderedEventRegistry::expelRecordedEvents()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 11
ccs 6
cts 6
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Dsantang\DomainEvents\Registry;
6
7
use Dsantang\DomainEvents\Counter;
8
use Dsantang\DomainEvents\DomainEvent;
9
use Dsantang\DomainEvents\EventAware;
10
11
trait OrderedEventRegistry
12
{
13
    /** @var DomainEvent[] */
14
    private $recordedEvents = [];
15
16
    /**
17
     * @return DomainEvent[]
18
     *
19
     * @throws IncompatibleClass
20
     */
21 3
    public function expelRecordedEvents() : array
22
    {
23 3
        if ($this instanceof EventAware === false) {
24 1
            throw IncompatibleClass::forExpellingEvents($this);
25
        }
26
27 2
        $recordedEvents = $this->recordedEvents;
28
29 2
        $this->recordedEvents = [];
30
31 2
        return $recordedEvents;
32
    }
33
34
    /**
35
     * @throws IncompatibleClass
36
     */
37 2
    private function triggeredA(DomainEvent $event) : void
38
    {
39 2
        if ($this instanceof EventAware === false) {
40 1
            throw IncompatibleClass::forTriggeringEvents($this);
41
        }
42
43 1
        $this->recordedEvents[Counter::getNext()] = $event;
44 1
    }
45
}
46