Passed
Push — main ( c5252d...05244e )
by Breno
02:05
created

EventManager::release()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace OniBus\Event;
5
6
use Generator;
7
8
final class EventManager extends EventProvider
9
{
10
    private static $eventProvider = null;
11
12
    private function __construct()
13
    {
14
    }
15
16
    public static function eventProvider(): EventProvider
17
    {
18
        if (is_null(self::$eventProvider)) {
19
            self::$eventProvider = new self();
20
        }
21
22
        return self::$eventProvider;
23
    }
24
25
    public static function record(Event ...$events): void
26
    {
27
        self::eventProvider()->recordEvent(...$events);
28
    }
29
30
    public static function release(): Generator
31
    {
32
        return self::eventProvider()->releaseEvents();
33
    }
34
}
35