Completed
Push — master ( e22a75...ab6153 )
by Iman
04:58
created

BasicEventManager   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 23
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 5 1
A startGuarding() 0 4 1
1
<?php
2
3
namespace Imanghafoori\HeyMan\WatchingStrategies;
4
5
use Illuminate\Support\Facades\Event;
6
7
class BasicEventManager
8
{
9
    private $events;
10
11
    /**
12
     * ConditionApplier constructor.
13
     *
14
     * @param $event
15
     */
16 17
    public function init($event)
17
    {
18 17
        $this->events = $event;
19
20 17
        return $this;
21
    }
22
23
    /**
24
     * @param $callback
25
     */
26 17
    public function startGuarding(callable $callback)
27
    {
28 17
        Event::listen($this->events, $callback);
29 17
        $this->events = [];
30 17
    }
31
}
32