Completed
Push — master ( 29d79e...8aac64 )
by Iman
09:16
created

Responder::json()   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 4
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\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
 * @package Imanghafoori\HeyMan\Reactions
19 2
 */
20
class Responder
21 2
{
22 2
    private $chain;
23 2
24
    private $action;
25
26
    /**
27
     * Responder constructor.
28
     *
29
     * @param \Imanghafoori\HeyMan\Chain $chain
30
     * @param $action
31
     */
32 1
    public function __construct(Chain $chain, $action)
33
    {
34 1
        $this->chain = $chain;
35 1
        $this->action = $action;
36
    }
37
38
    public function __call($method, $parameters)
39
    {
40
        $this->chain->commitArray([$method, $parameters], 'response');
41
    }
42
}
43