ConfigAbstract   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A formClassNamespace() 0 3 1
A formClassName() 0 3 1
A formExtends() 0 3 1
A classProperties() 0 15 3
A formOutputPath() 0 3 1
1
<?php
2
3
namespace carono\etxtru\codegen;
4
5
6
use carono\codegen\ClassGenerator;
7
8
class ConfigAbstract extends ClassGenerator
9
{
10
    protected function formExtends()
11
    {
12
        return 'carono\etxtru\ConfigAbstract';
13
    }
14
15
    protected function formClassName()
16
    {
17
        return formClassName($this->params['api'] . '_' . $this->params['name'], []) . 'Config';
18
    }
19
20
    protected function formClassNamespace()
21
    {
22
        return 'carono\etxtru\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
}