SetFieldTypeOnEdit::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 2
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\FieldGenerator\Middleware;
4
5
use League\Tactician\Middleware;
6
use Hechoenlaravel\JarvisFoundation\FieldGenerator\FieldModel;
7
8
class SetFieldTypeOnEdit 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
        $field = FieldModel::find($command->id);
19
        $command->type = $field->type;
20
        return $next($command);
21
    }
22
}
23