ClassDefinition::getField()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 7
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PHPTdGram\SchemaGenerator\Model;
6
7
/**
8
 * @author  Aurimas Niekis <[email protected]>
9
 */
10
class ClassDefinition
11
{
12
    public string $parentClass;
13
    public string $className;
14
    public string $classDocs;
15
16
    /** @var FieldDefinition[] */
17
    public array  $fields = [];
18
    public string $returnType;
19
    public string $typeName;
20
21
    public function getField(string $name): FieldDefinition
22
    {
23
        if (false === isset($this->fields[$name])) {
24
            $this->fields[$name] = new FieldDefinition();
25
        }
26
27
        return $this->fields[$name];
28
    }
29
}
30