Issues (49)

src/Builder/FormBuilderTrait.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Lagdo\UiBuilder\Builder;
4
5
use Lagdo\UiBuilder\Component\Base;
6
7
trait FormBuilderTrait
8
{
9
    /**
10
     * @var string
11
     */
12
    protected string $formComponentClass = '';
13
14
    /**
15
     * @var string
16
     */
17
    protected string $labelComponentClass = '';
18
19
    /**
20
     * @var string
21
     */
22
    protected string $inputComponentClass = '';
23
24
    /**
25
     * @var string
26
     */
27
    protected string $textareaComponentClass = '';
28
29
    /**
30
     * @var string
31
     */
32
    protected string $checkboxComponentClass = '';
33
34
    /**
35
     * @var string
36
     */
37
    protected string $radioComponentClass = '';
38
39
    /**
40
     * @var string
41
     */
42
    protected string $selectComponentClass = '';
43
44
    /**
45
     * @var string
46
     */
47
    protected string $optionComponentClass = '';
48
49
    /**
50
     * @var string
51
     */
52
    protected string $inputGroupComponentClass = '';
53
54
    /**
55
     * @inheritDoc
56
     */
57
    public function form(...$arguments): Base\FormComponent
58
    {
59
        return $this->createComponentOfClass($this->formComponentClass, $arguments);
0 ignored issues
show
It seems like createComponentOfClass() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

59
        return $this->/** @scrutinizer ignore-call */ createComponentOfClass($this->formComponentClass, $arguments);
Loading history...
60
    }
61
62
    /**
63
     * @inheritDoc
64
     */
65
    public function label(...$arguments): Base\LabelComponent
66
    {
67
        return $this->createComponentOfClass($this->labelComponentClass, $arguments);
68
    }
69
70
    /**
71
     * @inheritDoc
72
     */
73
    public function input(...$arguments): Base\InputComponent
74
    {
75
        return $this->createComponentOfClass($this->inputComponentClass, $arguments);
76
    }
77
78
    /**
79
     * @inheritDoc
80
     */
81
    public function textarea(...$arguments): Base\TextareaComponent
82
    {
83
        return $this->createComponentOfClass($this->textareaComponentClass, $arguments);
84
    }
85
86
    /**
87
     * @inheritDoc
88
     */
89
    public function checkbox(...$arguments): Base\CheckboxComponent
90
    {
91
        return $this->createComponentOfClass($this->checkboxComponentClass, $arguments);
92
    }
93
94
    /**
95
     * @inheritDoc
96
     */
97
    public function radio(...$arguments): Base\RadioComponent
98
    {
99
        return $this->createComponentOfClass($this->radioComponentClass, $arguments);
100
    }
101
102
    /**
103
     * @inheritDoc
104
     */
105
    public function select(...$arguments): Base\SelectComponent
106
    {
107
        return $this->createComponentOfClass($this->selectComponentClass, $arguments);
108
    }
109
110
    /**
111
     * @inheritDoc
112
     */
113
    public function option(...$arguments): Base\OptionComponent
114
    {
115
        return $this->createComponentOfClass($this->optionComponentClass, $arguments);
116
    }
117
118
    /**
119
     * @inheritDoc
120
     */
121
    public function inputGroup(...$arguments): Base\InputGroupComponent
122
    {
123
        return $this->createComponentOfClass($this->inputGroupComponentClass, $arguments);
124
    }
125
}
126