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
Push — master ( 5bd507...bc36f8 )
by Davide
47s queued 10s
created

OrderedEventRegistry   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A triggeredA() 0 7 2
A expelRecordedEvents() 0 11 2
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