View   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
c 1
b 0
f 1
lcom 1
cbo 2
dl 0
loc 26
ccs 5
cts 5
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 8 1
1
<?php
2
/**
3
 * @link https://github.com/roboapp
4
 * @copyright Copyright (c) 2016 Roboapp
5
 * @license [MIT License](https://opensource.org/licenses/MIT)
6
 */
7
8
namespace roboapp\crud;
9
10
/**
11
 * Action displays an existing model.
12
 *
13
 * @author iRipVanWinkle <[email protected]>
14
 * @since 1.0
15
 */
16
class View extends BaseAction
17
{
18
    /**
19
     * @var string name of the view
20
     */
21
    public $view = 'view';
22
23
    /**
24
     * @var string the name variable model in the view template
25
     */
26
    public $nameVariableModel = 'model';
27
28
    /**
29
     * Views existing record.
30
     * @param mixed $id ID of the model to be view
31
     * @return mixed response
32
     */
33 3
    public function run($id)
34
    {
35 3
        $model = $this->getModel($id);
36
37 3
        return $this->controller->render($this->view, [
38 3
            $this->nameVariableModel => $model,
39 3
        ]);
40
    }
41
}
42