CreateTheFieldSlug   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 7 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