SetCommandDataFromEditFieldModel   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 8 2
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\FieldGenerator\Middleware;
4
5
use Hechoenlaravel\JarvisFoundation\FieldGenerator\FieldModel;
6
use League\Tactician\Middleware;
7
8
class SetCommandDataFromEditFieldModel implements Middleware
9
{
10
    /**
11
     * @param object $command
12
     * @param callable $next
13
     *
14
     * @return mixed
15
     */
16
    public function execute($command, callable $next)
17
    {
18
        $model = FieldModel::find($command->id);
19
        if (!isset($command->locked)) {
20
            $command->locked = $model->locked;
21
        }
22
        return $next($command);
23
    }
24
}
25