Passed
Push — master ( 743cc2...6ffec3 )
by Oleg
02:50
created

SimpleProvider::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DFCodeGeneration\Generator\Factory;
5
6
use SlayerBirden\DFCodeGeneration\Generator\Controllers\NamingTrait as ControllerNamingTrait;
7
8
class SimpleProvider implements DataProviderInterface
9
{
10
    use NamingTrait, ControllerNamingTrait {
11
        NamingTrait::getBaseName insteadof ControllerNamingTrait;
12
        NamingTrait::getNs insteadof ControllerNamingTrait;
13
        ControllerNamingTrait::getNs as getControllerNs;
14
    }
15
16
    /**
17
     * @var string
18
     */
19
    private $entityClassName;
20
21 2
    public function __construct(string $entityClassName)
22
    {
23 2
        $this->entityClassName = $entityClassName;
24 2
    }
25
26
    /**
27
     * @return array
28
     * @throws \ReflectionException
29
     */
30 1
    public function provide(): array
31
    {
32
        return [
33 1
            'ns' => $this->getNs($this->entityClassName),
34 1
            'controllerNs' => $this->getControllerNs($this->entityClassName),
35 1
            'entityName' => $this->getBaseName($this->entityClassName),
36
        ];
37
    }
38
39
    /**
40
     * @return string
41
     * @throws \ReflectionException
42
     */
43 1
    public function getClassName(): string
44
    {
45 1
        return $this->getNs($this->entityClassName) . '\\' . $this->getBaseName($this->entityClassName) . 'RoutesDelegator';
46
    }
47
}
48