AbstractFactory   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 43
rs 10
c 0
b 0
f 0
ccs 12
cts 12
cp 1
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfig() 0 6 1
A __construct() 0 3 1
A getEntityClassName() 0 3 1
A getCode() 0 3 1
A getControllerNamespace() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DFCodeGeneration\Generator\Config\Parts\Get;
5
6
use SlayerBirden\DFCodeGeneration\Generator\Config\ConfigPartInterface;
7
use SlayerBirden\DFCodeGeneration\Generator\DataProvider\DataProviderInterface;
8
9
final class AbstractFactory implements ConfigPartInterface
10
{
11
    const PART_KEY = \Zend\ServiceManager\AbstractFactory\ConfigAbstractFactory::class;
12
13
    /**
14
     * @var DataProviderInterface
15
     */
16
    private $dataProvider;
17
18 2
    public function __construct(DataProviderInterface $dataProvider)
19
    {
20 2
        $this->dataProvider = $dataProvider;
21 2
    }
22
23
    /**
24
     * @inheritdoc
25
     */
26 2
    public function getConfig(): array
27
    {
28 2
        $name = '\\' . $this->getControllerNamespace() . '\Get' . $this->getEntityClassName() . 'Action::class';
29
        return [
30
            $name => [
31 2
                $this->dataProvider->provide()['hydrator_name'],
32
            ]
33
        ];
34
    }
35
36
    /**
37
     * @inheritdoc
38
     */
39 2
    public function getCode(): string
40
    {
41 2
        return self::PART_KEY;
42
    }
43
44 2
    private function getEntityClassName(): string
45
    {
46 2
        return $this->dataProvider->provide()['entityClassName'];
47
    }
48
49 2
    private function getControllerNamespace(): string
50
    {
51 2
        return $this->dataProvider->provide()['controller_namespace'];
52
    }
53
}
54