CommandInstanceTrait::getCommandInstance()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 9
ccs 0
cts 8
cp 0
crap 6
rs 10
1
<?php
2
namespace App\Traits;
3
4
use Ramsey\Uuid\UuidInterface;
5
use ReflectionClass;
6
7
trait CommandInstanceTrait
8
{
9
    /**
10
     * @param UuidInterface|null $uuid
11
     * @param string $name
12
     * @return ReflectionClass
13
     */
14
    private function getCommandInstance(?UuidInterface $uuid, string $name): ReflectionClass
15
    {
16
        if (empty($uuid)) {
17
            $class = new ReflectionClass('\App\Command\Create'.$name.'Command');
18
        } else {
19
            $class = new ReflectionClass('\App\Command\Update'.$name.'Command');
20
        }
21
22
        return $class;
23
    }
24
}
25