EventStorage::turnOff()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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