CreateTheFieldSlug::execute()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 2
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\FieldGenerator\Middleware;
4
5
use League\Tactician\Middleware;
6
7
class CreateTheFieldSlug implements Middleware
8
{
9
    /**
10
     * @param object $command
11
     * @param callable $next
12
     *
13
     * @return mixed
14
     */
15
    public function execute($command, callable $next)
16
    {
17
        if (empty($command->slug)) {
18
            $command->slug = str_slug($command->name, '_');
19
        }
20
        return $next($command);
21
    }
22
}
23