Completed
Push — master ( 8aac64...6ed379 )
by Iman
16:55 queued 13:14
created

Responder   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 21
rs 10
c 0
b 0
f 0
ccs 6
cts 6
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __call() 0 3 1
A __construct() 0 4 1
1
<?php
2
3
namespace Imanghafoori\HeyMan\Reactions;
4
5
use Imanghafoori\HeyMan\Chain;
6
7
/**
8
 * Class Responder.
9
 *
10
 * @method null make(string $content = '', int $status = 200, array $headers = [])
11
 * @method null view(string $view, array $data = [], int $status = 200, array $headers = [])
12
 * @method null json($data = [], $status = 200, array $headers = [], $options = 0)
13
 * @method null jsonp($callback, $data = [], $status = 200, array $headers = [], $options = 0)
14
 * @method null stream($callback, $status = 200, array $headers = [])
15
 * @method null streamDownload($callback, $name = null, array $headers = [], $disposition = 'attachment')
16
 * @method null download($file, $name = null, array $headers = [], $disposition = 'attachment')
17
 */
18
class Responder
19
{
20
    private $chain;
21
22
    private $action;
23
24
    /**
25
     * Responder constructor.
26
     *
27
     * @param \Imanghafoori\HeyMan\Chain $chain
28
     * @param $action
29
     */
30 2
    public function __construct(Chain $chain, $action)
31
    {
32 2
        $this->chain = $chain;
33 2
        $this->action = $action;
34 2
    }
35
36 2
    public function __call($method, $parameters)
37
    {
38 2
        $this->chain->commitArray([$method, $parameters], 'response');
39 2
    }
40
}
41