Test Failed
Pull Request — master (#159)
by Sergei
03:08
created

FieldFactoryConfig   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 26
dl 0
loc 69
rs 10
c 1
b 0
f 0
wmc 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A inputTextConfig() 0 5 1
A labelConfig() 0 5 1
A setInputIdAttribute() 0 5 1
A getTemplate() 0 3 1
A getHintConfig() 0 3 1
A getInputTextConfig() 0 3 1
A getSetInputIdAttribute() 0 3 1
A template() 0 5 1
A hintConfig() 0 5 1
A getLabelConfig() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Form;
6
7
final class FieldFactoryConfig
8
{
9
    private ?string $template = null;
10
11
    private ?bool $setInputIdAttribute = null;
12
13
    private array $labelConfig = [];
14
    private array $hintConfig = [];
15
16
    private array $inputTextConfig = [];
17
18
    public function template(?string $template): self
19
    {
20
        $new = clone $this;
21
        $new->template = $template;
22
        return $new;
23
    }
24
25
    public function setInputIdAttribute(?bool $value): self
26
    {
27
        $new = clone $this;
28
        $new->setInputIdAttribute = $value;
29
        return $new;
30
    }
31
32
    public function labelConfig(array $config): self
33
    {
34
        $new = clone $this;
35
        $new->labelConfig = $config;
36
        return $new;
37
    }
38
39
    public function hintConfig(array $config): self
40
    {
41
        $new = clone $this;
42
        $new->hintConfig = $config;
43
        return $new;
44
    }
45
46
    public function inputTextConfig(array $config): self
47
    {
48
        $new = clone $this;
49
        $new->inputTextConfig = $config;
50
        return $new;
51
    }
52
53
    public function getTemplate(): ?string
54
    {
55
        return $this->template;
56
    }
57
58
    public function getSetInputIdAttribute(): ?bool
59
    {
60
        return $this->setInputIdAttribute;
61
    }
62
63
    public function getLabelConfig(): array
64
    {
65
        return $this->labelConfig;
66
    }
67
68
    public function getHintConfig(): array
69
    {
70
        return $this->hintConfig;
71
    }
72
73
    public function getInputTextConfig(): array
74
    {
75
        return $this->inputTextConfig;
76
    }
77
}
78