Restore   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 71.43%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 10 2
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
 * Actions performs restoration of the soft deleted record.
12
 * This action supports [roboapp/softdelete](https://github.com/roboapp/softdelete) extension.
13
 *
14
 * @see https://github.com/roboapp/softdelete
15
 *
16
 * @author iRipVanWinkle <[email protected]>
17
 * @since 1.0
18
 */
19
class Restore extends BaseAction
20
{
21
    /**
22
     * Restore model
23
     * @param mixed $id ID of the model to be restored.
24
     * @return mixed
25
     */
26 3
    public function run($id)
27
    {
28 3
        $model = $this->getModel($id);
29 3
        
30
        if ($model->restore()) {
31
            $this->addSuccessFlash();
32 3
        }
33
34
        return $this->redirect($model);
35 3
    }
36
}
37