Passed
Push — main ( 0d5649...d7c64d )
by Breno
01:51
created

EventManager   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 5
c 1
b 0
f 0
dl 0
loc 20
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A singleInstance() 0 3 1
A releaseEvents() 0 3 1
A recordEvent() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace OniBus\Event;
5
6
use OniBus\Utility\Singleton;
7
8
/**
9
 * @method static EventProvider instance()
10
 */
11
final class EventManager
12
{
13
    use Singleton;
14
15
    protected static function singleInstance(): EventProvider
16
    {
17
        return new EventProvider();
18
    }
19
20
    public static function recordEvent(Event ...$events): void
21
    {
22
        self::instance()->recordEvent(...$events);
23
    }
24
25
    /**
26
     * @return Event[]
27
     */
28
    public static function releaseEvents(): iterable
29
    {
30
        return self::instance()->releaseEvents();
0 ignored issues
show
Bug Best Practice introduced by
The expression return self::instance()->releaseEvents() returns the type Generator which is incompatible with the documented return type OniBus\Event\Event[].
Loading history...
31
    }
32
}
33