SetEntity   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 5 1
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\Entries\Middleware;
4
5
use League\Tactician\Middleware;
6
use Hechoenlaravel\JarvisFoundation\EntityGenerator\EntityModel;
7
8
/**
9
 * Class SetEntity
10
 * Set the entity model for the entry to be created or updated
11
 * @package Hechoenlaravel\JarvisFoundation\Entries\Middleware
12
 */
13
class SetEntity implements Middleware
14
{
15
    /**
16
     * Execute the Middleware
17
     * @param object $command
18
     * @param callable $next
19
     * @return mixed
20
     */
21
    public function execute($command, callable $next)
22
    {
23
        $command->entity = EntityModel::findOrFail($command->entity);
24
        return $next($command);
25
    }
26
}
27