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

BasicEventManager::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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