Completed
Push — master ( 3707ab...b1ac4b )
by Iman
04:03
created

Chain::addAfterCall()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Imanghafoori\HeyMan;
4
5
class Chain
6
{
7
    /**
8
     * @var \Imanghafoori\HeyMan\ListenerApplier
9
     */
10
    public $authorizer;
11
12
    public $predicate;
13
14
    public $response = [];
15
16
    public $redirect = [];
17
18
    public $exception = [];
19
20
    public $events = [];
21
22
    public $abort;
23
24
    public $calls;
25
26 56
    public function reset()
27
    {
28 56
        $this->redirect = [];
29 56
        $this->exception = [];
30 56
        $this->response = [];
31 56
        $this->predicate = null;
32 56
        $this->abort = null;
33
        //$this->authorizer = null;
34 56
    }
35
36 4
    public function addRedirect($method, $params)
37
    {
38 4
        $this->redirect[] = [$method, $params];
39 4
    }
40
41 2
    public function addResponse($method, $params)
42
    {
43 2
        $this->response[] = [$method, $params];
44 2
    }
45
46 53
    public function addException($className, $message)
47
    {
48 53
        $this->exception = ['class' => $className, 'message' => $message];
49 53
    }
50
51 1
    public function addAbort($code, $message, $headers)
52
    {
53 1
        $this->abort = [$code, $message, $headers];
54 1
    }
55
56 2
    public function addAfterCall($callback, $parameters)
57
    {
58 2
        $this->calls[] = [$callback, $parameters];
59 2
    }
60
61 1
    public function eventFire($event, $payload, $halt)
62
    {
63 1
        $this->events[] = [$event, $payload, $halt];
64
    }
65
}