InMemoryRecorder::record()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 0
cts 7
cp 0
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
crap 6
1
<?php namespace Cairns\Radiate\Recorder;
2
3
final class InMemoryRecorder implements Recorder
4
{
5
    private $events = [];
6
7
    public function release()
8
    {
9
        $events = $this->events;
10
11
        $this->clear();
12
13
        return $events;
14
    }
15
16
    public function clear()
17
    {
18
        $this->events = [];
19
    }
20
21
    public function record($events)
22
    {
23
        if (! $events) {
24
            return;
25
        }
26
27
        $this->events = array_merge($this->events, $events);
28
    }
29
}
30