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

SimpleProvider   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 38
rs 10
c 0
b 0
f 0
ccs 9
cts 9
cp 1
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getClassName() 0 3 1
A __construct() 0 3 1
A provide() 0 6 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