EventStorage   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 23
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A store() 0 4 1
A release() 0 7 1
1
<?php
2
3
namespace hiapi\event;
4
5
use hiapi\event\EventStorageInterface;
6
7
/**
8
 * Class EventStorage
9
 *
10
 * @author Dmytro Naumenko <[email protected]>
11
 */
12
class EventStorage implements EventStorageInterface
13
{
14
    /**
15
     * @var array
16
     */
17
    protected $events = [];
18
19
    /**
20
     * @param object ...$events
21
     */
22
    public function store(...$events): void
23
    {
24
        $this->events = array_merge($this->events, $events);
25
    }
26
27
    public function release(): array
28
    {
29
        $events = $this->events;
30
        $this->events = [];
31
32
        return $events;
33
    }
34
}
35