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

BeforeReaction::pushIt()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

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