Completed
Push — master ( 6ffec3...6f905d )
by Oleg
06:32
created

BaseNameTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 19
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getBaseName() 0 8 2
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DFCodeGeneration\Generator;
5
6
use Zend\Code\Reflection\ClassReflection;
7
8
trait BaseNameTrait
9
{
10
    /**
11
     * @var string
12
     */
13
    private $baseName;
14
15
    /**
16
     * @return string
17
     * @throws \ReflectionException
18
     */
19 15
    public function getBaseName(): string
20
    {
21 15
        if ($this->baseName === null) {
22 15
            $reflection = new ClassReflection($this->entityClassName);
0 ignored issues
show
Bug Best Practice introduced by
The property entityClassName does not exist on SlayerBirden\DFCodeGener...Generator\BaseNameTrait. Did you maybe forget to declare it?
Loading history...
23 15
            $this->baseName = $reflection->getShortName();
24
        }
25
26 15
        return $this->baseName;
27
28
    }
29
}
30