CreateTransitionCommandHandler   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 18
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 10 1
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\Flows\Handler;
4
5
use Hechoenlaravel\JarvisFoundation\Flows\Transition;
6
use Hechoenlaravel\JarvisFoundation\Flows\Events\TransitionWasCreated;
7
8
/**
9
 * Class CreateTransitionCommandHandler
10
 * @package Hechoenlaravel\JarvisFoundation\Flows\Handler
11
 */
12
class CreateTransitionCommandHandler
13
{
14
    /**
15
     * @param $command
16
     * @return static
17
     */
18
19
    public function handle($command)
20
    {
21
        $transition = Transition::create([
22
            'flow_id' => $command->flow->id,
23
            'step_from_id' => $command->from->id,
24
            'step_to_id' => $command->to->id,
25
        ]);
26
        event(new TransitionWasCreated($transition));
27
        return $transition;
28
    }
29
}
30