Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 71
0.00% covered (danger)
0.00%
0 / 34
CRAP
0.00% covered (danger)
0.00%
0 / 1
CustomField
0.00% covered (danger)
0.00%
0 / 71
0.00% covered (danger)
0.00%
0 / 34
1332
0.00% covered (danger)
0.00%
0 / 1
 setIdentifier
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getIdentifier
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setName
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setType
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getType
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setList
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 isList
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setListWidth
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getListWidth
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setReadonly
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 isReadonly
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setFirebird
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getFirebird
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setPlaceholder
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getPlaceholder
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setRequired
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 isRequired
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setValidation
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getValidation
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setValidationMinLength
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getValidationMinLength
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setValidationMaxLength
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getValidationMaxLength
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setBlock
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
12
 getBlock
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setOptions
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getOptions
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setOrder
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 getOrder
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setDisabled
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 isDisabled
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getDisabled
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 toArray
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 1
2
1<?php declare(strict_types=1);
2
3namespace Satag\AmicronEntityBundle\CustomField;
4
5class CustomField
6{
7    protected string $identifier = '';
8
9    protected string $name = '';
10
11    protected string $type = 'String';
12
13    protected bool $list = true;
14
15    protected int $listWidth = 100;
16
17    protected bool $readonly = true;
18
19    protected ?string $firebird = null;
20
21    protected string $placeholder = '';
22
23    protected bool $required = false;
24
25    protected ?string $validation = null;
26
27    protected ?int $validationMinLength = null;
28
29    protected ?int $validationMaxLength = null;
30
31    /**
32     * If set, indicates that this field uses a code block editor.
33     * Supported values: "json" or "yaml".
34     */
35    protected ?string $block = null;
36
37    /**
38     * @var array<array-key, mixed>
39     */
40    protected array $options = [];
41
42    protected int $order = 0;
43
44    protected bool $disabled = false;
45
46    public function setIdentifier(string $identifier): self
47    {
48        $this->identifier = $identifier;
49
50        return $this;
51    }
52
53    public function getIdentifier(): string
54    {
55        return $this->identifier;
56    }
57
58    public function setName(string $name): self
59    {
60        $this->name = $name;
61
62        return $this;
63    }
64
65    public function getName(): string
66    {
67        return $this->name;
68    }
69
70    public function setType(string $type): self
71    {
72        $this->type = $type;
73
74        return $this;
75    }
76
77    public function getType(): string
78    {
79        return $this->type;
80    }
81
82    public function setList(bool $list): self
83    {
84        $this->list = $list;
85
86        return $this;
87    }
88
89    public function isList(): bool
90    {
91        return $this->list;
92    }
93
94    public function setListWidth(int $listWidth): self
95    {
96        $this->listWidth = $listWidth;
97
98        return $this;
99    }
100
101    public function getListWidth(): int
102    {
103        return $this->listWidth;
104    }
105
106    public function setReadonly(bool $readonly): self
107    {
108        $this->readonly = $readonly;
109
110        return $this;
111    }
112
113    public function isReadonly(): bool
114    {
115        return $this->readonly;
116    }
117
118    public function setFirebird(?string $firebird): self
119    {
120        $this->firebird = $firebird;
121
122        return $this;
123    }
124
125    public function getFirebird(): ?string
126    {
127        return $this->firebird;
128    }
129
130    public function setPlaceholder(string $placeholder): self
131    {
132        $this->placeholder = $placeholder;
133
134        return $this;
135    }
136
137    public function getPlaceholder(): string
138    {
139        return $this->placeholder;
140    }
141
142    public function setRequired(bool $required): self
143    {
144        $this->required = $required;
145
146        return $this;
147    }
148
149    public function isRequired(): bool
150    {
151        return $this->required;
152    }
153
154    public function setValidation(?string $validation): self
155    {
156        $this->validation = $validation;
157
158        return $this;
159    }
160
161    public function getValidation(): ?string
162    {
163        return $this->validation;
164    }
165
166    public function setValidationMinLength(?int $length): self
167    {
168        $this->validationMinLength = $length;
169
170        return $this;
171    }
172
173    public function getValidationMinLength(): ?int
174    {
175        return $this->validationMinLength;
176    }
177
178    public function setValidationMaxLength(?int $length): self
179    {
180        $this->validationMaxLength = $length;
181
182        return $this;
183    }
184
185    public function getValidationMaxLength(): ?int
186    {
187        return $this->validationMaxLength;
188    }
189
190    public function setBlock(?string $block): self
191    {
192        // keep minimal validation to accepted values if provided
193        if ($block !== null) {
194            $block = strtolower($block);
195            if (!\in_array($block, ['json', 'yaml'], true)) {
196                // silently ignore invalid values to keep BC minimal
197                $block = null;
198            }
199        }
200        $this->block = $block;
201
202        return $this;
203    }
204
205    public function getBlock(): ?string
206    {
207        return $this->block;
208    }
209
210    /**
211     * @param array<array-key, mixed> $options
212     */
213    public function setOptions(array $options): self
214    {
215        $this->options = $options;
216
217        return $this;
218    }
219
220    /**
221     * @return array<array-key, mixed>
222     */
223    public function getOptions(): array
224    {
225        return $this->options;
226    }
227
228    public function setOrder(int $order): self
229    {
230        $this->order = $order;
231
232        return $this;
233    }
234
235    public function getOrder(): int
236    {
237        return $this->order;
238    }
239
240    public function setDisabled(bool $disabled): self
241    {
242        $this->disabled = $disabled;
243
244        return $this;
245    }
246
247    public function isDisabled(): bool
248    {
249        return $this->disabled;
250    }
251
252    public function getDisabled(): bool
253    {
254        return $this->disabled;
255    }
256
257    /**
258     * @return array<string, mixed>
259     */
260    public function toArray(): array
261    {
262        return [
263            'identifier' => $this->identifier,
264            'name' => $this->name,
265            'type' => $this->type,
266            'list' => $this->list,
267            'listWidth' => $this->listWidth,
268            'readonly' => $this->readonly,
269            'firebird' => $this->firebird,
270            'placeholder' => $this->placeholder,
271            'required' => $this->required,
272            'validation' => $this->validation,
273            'validationMinLength' => $this->validationMinLength,
274            'validationMaxLength' => $this->validationMaxLength,
275            'block' => $this->block,
276            'options' => $this->options,
277            'order' => $this->order,
278            'disabled' => $this->disabled,
279        ];
280    }
281}