RenderJsonAction::run()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 6
1
<?php
2
/**
3
 * HiPanel core package
4
 *
5
 * @link      https://hipanel.com/
6
 * @package   hipanel-core
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2014-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\actions;
12
13
/**
14
 * Class RenderJsonAction.
15
 */
16
class RenderJsonAction extends Action
17
{
18
    /**
19
     * @var callback|array view to render
20
     */
21
    public $return;
22
23
    public function run()
24
    {
25
        $data = $this->return instanceof \Closure ? call_user_func($this->return, $this) : $this->return;
26
27
        return $this->controller->renderJson($data);
28
    }
29
}
30