Passed
Push — master ( f53786...68dd01 )
by Iman
10:13
created

BeforeReaction   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
eloc 5
dl 0
loc 16
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A afterCalling() 0 3 1
A afterFiringEvent() 0 3 1
A pushIt() 0 4 1
1
<?php
2
3
namespace Imanghafoori\HeyMan\Reactions;
4
5
use Imanghafoori\HeyMan\ChainManager;
6
7
trait BeforeReaction
8
{
9 2
    public function afterCalling($callback, array $parameters = []): self
10
    {
11 2
        return $this->pushIt([[$callback, $parameters], 'cb']);
12
    }
13 2
14
    public function afterFiringEvent($event, $payload = [], $halt = false): self
15
    {
16 1
        return $this->pushIt([[$event, $payload, $halt], 'event']);
17
    }
18 1
19
    private function pushIt($arr)
20 1
    {
21
        resolve(ChainManager::class)->push('beforeReaction', $arr);
22
        return $this;
23
    }
24
}
25