ConfigProvider   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 26
dl 0
loc 63
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 9 1
A getValidatorsConfig() 0 4 1
A getDoctrineConfig() 0 8 1
A getDependenciesConfig() 0 6 1
A getStockInputFilterSpec() 0 15 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DFCodeGeneration\Catalog;
5
6
final class ConfigProvider
7
{
8
    public function __invoke(): array
9
    {
10
        return [
11
            'input_filter_specs' => [
12
                'StockInputFilter' => $this->getStockInputFilterSpec(),
13
            ],
14
            'doctrine' => $this->getDoctrineConfig(),
15
            'dependencies' => $this->getDependenciesConfig(),
16
            'validators' => $this->getValidatorsConfig(),
17
        ];
18
    }
19
20
    private function getStockInputFilterSpec(): array
21
    {
22
        return [
23
            'qty' => [
24
                'filters' => [
25
                    [
26
                        'name' => 'stringtrim',
27
                    ]
28
                ],
29
                'validators' => [
30
                    [
31
                        'name' => 'notempty',
32
                    ],
33
                    [
34
                        'name' => 'digits',
35
                    ],
36
                ],
37
            ],
38
        ];
39
    }
40
41
    private function getDoctrineConfig(): array
42
    {
43
        return [
44
            'entity_managers' => [
45
                'default' => [
46
                    'paths' => [
47
                        'src/Catalog/Entities',
48
                        'vendor/my_awesome_paths',
49
                    ],
50
                ],
51
            ],
52
        ];
53
    }
54
55
    private function getDependenciesConfig(): array
56
    {
57
        return [
58
            'factories' => [
59
                'ProductHydrator' => '\SlayerBirden\DFCodeGeneration\Catalog\Factory\ProductHydratorFactory',
60
                'SomeAwesomeDep' => '\My\Awesome\Factory',
61
            ],
62
        ];
63
    }
64
65
    private function getValidatorsConfig(): array
66
    {
67
        return [
68
            'validators_are_awesome',
69
        ];
70
    }
71
}
72