EventStorage   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 0
Metric Value
wmc 6
lcom 2
cbo 0
dl 0
loc 43
c 0
b 0
f 0
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A logEvent() 0 7 1
A popAll() 0 8 1
A turnOff() 0 4 1
A turnOn() 0 4 1
A isOn() 0 4 1
A isOff() 0 4 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: AntonioCarlos
5
 * Date: 03/06/2014
6
 * Time: 18:30.
7
 */
8
9
namespace PragmaRX\Tracker\Eventing;
10
11
class EventStorage
12
{
13
    private $events = [];
14
15
    private $isOn = true;
16
17
    public function logEvent($event, $object)
18
    {
19
        $this->events[] = [
20
            'event'  => $event,
21
            'object' => $object,
22
        ];
23
    }
24
25
    public function popAll()
26
    {
27
        $events = $this->events;
28
29
        $this->events = [];
30
31
        return $events;
32
    }
33
34
    public function turnOff()
35
    {
36
        $this->isOn = false;
37
    }
38
39
    public function turnOn()
40
    {
41
        $this->isOn = true;
42
    }
43
44
    public function isOn()
45
    {
46
        return $this->isOn;
47
    }
48
49
    public function isOff()
50
    {
51
        return !$this->isOn;
52
    }
53
}
54