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

Chain   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 59
ccs 24
cts 24
cp 1
rs 10
c 0
b 0
f 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A addAfterCall() 0 3 1
A addResponse() 0 3 1
A addException() 0 3 1
A addAbort() 0 3 1
A addRedirect() 0 3 1
A reset() 0 7 1
A eventFire() 0 3 1
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
}