ConfigAbstract::formOutputPath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 1
nc 1
nop 0
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
}