Test Failed
Pull Request — master (#159)
by Alexander
02:49
created

FieldFactoryConfig   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 31
dl 0
loc 82
rs 10
c 1
b 0
f 0
wmc 12

12 Methods

Rating   Name   Duplication   Size   Complexity  
A inputTextConfig() 0 5 1
A setInputIdAttribute() 0 5 1
A labelConfig() 0 5 1
A getHintConfig() 0 3 1
A getTemplate() 0 3 1
A getInputTextConfig() 0 3 1
A hintConfig() 0 5 1
A template() 0 5 1
A getSetInputIdAttribute() 0 3 1
A getErrorConfig() 0 3 1
A errorConfig() 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
    private array $errorConfig = [];
16
17
    private array $inputTextConfig = [];
18
19
    public function template(?string $template): self
20
    {
21
        $new = clone $this;
22
        $new->template = $template;
23
        return $new;
24
    }
25
26
    public function setInputIdAttribute(?bool $value): self
27
    {
28
        $new = clone $this;
29
        $new->setInputIdAttribute = $value;
30
        return $new;
31
    }
32
33
    public function labelConfig(array $config): self
34
    {
35
        $new = clone $this;
36
        $new->labelConfig = $config;
37
        return $new;
38
    }
39
40
    public function hintConfig(array $config): self
41
    {
42
        $new = clone $this;
43
        $new->hintConfig = $config;
44
        return $new;
45
    }
46
47
    public function errorConfig(array $config): self
48
    {
49
        $new = clone $this;
50
        $new->errorConfig = $config;
51
        return $new;
52
    }
53
54
    public function inputTextConfig(array $config): self
55
    {
56
        $new = clone $this;
57
        $new->inputTextConfig = $config;
58
        return $new;
59
    }
60
61
    public function getTemplate(): ?string
62
    {
63
        return $this->template;
64
    }
65
66
    public function getSetInputIdAttribute(): ?bool
67
    {
68
        return $this->setInputIdAttribute;
69
    }
70
71
    public function getLabelConfig(): array
72
    {
73
        return $this->labelConfig;
74
    }
75
76
    public function getHintConfig(): array
77
    {
78
        return $this->hintConfig;
79
    }
80
81
    public function getErrorConfig(): array
82
    {
83
        return $this->errorConfig;
84
    }
85
86
    public function getInputTextConfig(): array
87
    {
88
        return $this->inputTextConfig;
89
    }
90
}
91