CreateFieldCommandHandler   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
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 15
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 7 1
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\FieldGenerator\Handler;
4
5
use Hechoenlaravel\JarvisFoundation\FieldGenerator\FieldModel;
6
use Hechoenlaravel\JarvisFoundation\EntityGenerator\EntityModel;
7
use Hechoenlaravel\JarvisFoundation\FieldGenerator\Events\FieldWasCreated;
8
9
/**
10
 * Class FieldGeneratorHandler
11
 * @package Hechoenlaravel\JarvisFoundation\FieldGenerator\Handler
12
 */
13
class CreateFieldCommandHandler
14
{
15
    /**
16
     * Handle the creation of the Field in the Database
17
     * @param $command
18
     * @return static
19
     */
20
    public function handle($command)
21
    {
22
        $command->namespace = EntityModel::find($command->entity_id)->namespace;
23
        $field = FieldModel::create((array) $command);
24
        event(new FieldWasCreated($field));
25
        return $field;
26
    }
27
}
28