EntityGeneratorHandler::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace Hechoenlaravel\JarvisFoundation\EntityGenerator\Handler;
4
5
use Hechoenlaravel\JarvisFoundation\EntityGenerator\EntityModel;
6
use Hechoenlaravel\JarvisFoundation\EntityGenerator\Events\EntityWasCreated;
7
8
/**
9
 * Class EntityGeneratorHandler
10
 * @package Hechoenlaravel\JarvisFoundation\EntityGenerator\Handler
11
 */
12
class EntityGeneratorHandler
13
{
14
    /**
15
     * Creates the Entity Record
16
     * @param $command
17
     * @return static
18
     */
19
    public function handle($command)
20
    {
21
        $entity = EntityModel::create((array) $command);
22
        event(new EntityWasCreated($entity));
23
        return $entity;
24
    }
25
}
26