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.

EventsTracker   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 20
rs 10
ccs 7
cts 7
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A aggregate() 0 3 1
A release() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Dsantang\DomainEventsDoctrine;
6
7
use Dsantang\DomainEvents\DomainEvent;
8
9
/**
10
 * Allows a Client to stage domain events that have been raised by the application.
11
 * It then offers a way to release those events at a second moment in time, in order, for example, to dispatch them.
12
 */
13
final class EventsTracker implements Aggregator, Releaser
14
{
15
    /** @var DomainEvent[] */
16
    private array $events = [];
17
18 2
    public function aggregate(DomainEvent ...$events): void
19
    {
20 2
        $this->events = $events;
21 2
    }
22
23
    /**
24
     * @return DomainEvent[]
25
     */
26 1
    public function release(): array
27
    {
28 1
        $events = $this->events;
29
30 1
        $this->events = [];
31
32 1
        return $events;
33
    }
34
}
35