ConfigAbstract   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 14
dl 0
loc 37
c 1
b 0
f 0
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A formOutputPath() 0 3 1
A formClassNamespace() 0 3 1
A formClassName() 0 3 1
A formExtends() 0 3 1
A classProperties() 0 15 3
1
<?php
2
3
namespace carono\turbotext\codegen;
4
5
6
use carono\codegen\ClassGenerator;
7
8
class ConfigAbstract extends ClassGenerator
9
{
10
    protected function formExtends()
11
    {
12
        return 'carono\turbotext\ConfigAbstract';
13
    }
14
15
    protected function formClassName()
16
    {
17
        return formClassName($this->params['name'], ['get_', '_array', 'create_']) . 'Config';
18
    }
19
20
    protected function formClassNamespace()
21
    {
22
        return 'carono\turbotext\config';
23
    }
24
25
    protected function formOutputPath()
26
    {
27
        return dirname(__DIR__) . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . $this->formClassName() . '.php';
28
    }
29
30
    protected function classProperties()
31
    {
32
        $properties = [];
33
        foreach ($this->params['params'] as $param) {
34
            if (is_string($param)) {
35
                continue;
36
            }
37
            $properties[$param['name']] = [
38
                'comment' => [
39
                    stripAndWordWrap(stripSpaces($param['description'])),
40
                    '@var ' . formParamType($param['type'])
41
                ]
42
            ];
43
        }
44
        return $properties;
45
    }
46
}