Passed
Branch master (046a17)
by Mathieu
02:22
created

FormField::getSettings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Neimheadh\SonataAnnotationBundle\Annotation;
6
7
/**
8
 * Form field annotation.
9
 *
10
 * Allows you to configure form field for the annotated property.
11
 *
12
 * @Annotation
13
 * @Target("PROPERTY")
14
 *
15
 * @author Marko Kunic <[email protected]>
16
 * @author Mathieu Wambre <[email protected]>
17
 */
18
final class FormField extends AbstractField implements
19
    ActionAnnotationInterface,
20
    PositionAnnotationInterface
21
{
22
23
    /**
24
     * Create action name.
25
     */
26
    public const ACTION_CREATE = 'create';
27
28
    /**
29
     * Edit action name.
30
     */
31
    public const ACTION_EDIT = 'edit';
32
33
    /**
34
     * Action name.
35
     *
36
     * @var string
37
     */
38
    public string $action;
39
40
    /**
41
     * Field options.
42
     *
43
     * @var array
44
     */
45
    public array $options = [];
46
47
    /**
48
     * Field position.
49
     *
50
     * @var int
51
     */
52
    public int $position;
53
54
    /**
55
     * Get field form settings.
56
     *
57
     * @return array
58
     */
59
    public function getSettings(): array
60
    {
61
        return [
62
            $this->type ?? null,
63
            $this->options,
64
            $this->fieldDescriptionOptions,
65
        ];
66
    }
67
68
}
69