Completed
Push — develop ( 4ba9d0...bf9538 )
by Thomas
13:06 queued 05:00
created

Field::getDefaultType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of Sulu.
5
 *
6
 * (c) MASSIVE ART WebServices GmbH
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Sulu\Bundle\AdminBundle\Metadata\Form;
13
14
class Field extends Item
15
{
16
    /**
17
     * @var Option[]
18
     */
19
    protected $options = [];
20
21
    /**
22
     * @var Form[]
23
     */
24
    protected $types = [];
25
26
    /**
27
     * @var string
28
     */
29
    protected $defaultType;
30
31
    /**
32
     * @var bool
33
     */
34
    protected $required;
35
36
    /**
37
     * @var null|int
38
     */
39
    protected $spaceAfter;
40
41
    /**
42
     * @var Tag[]
43
     */
44
    protected $tags;
45
46
    public function setType(string $type): void
47
    {
48
        $this->type = $type;
49
    }
50
51
    public function getOptions(): array
52
    {
53
        return $this->options;
54
    }
55
56
    public function addOption(Option $option): void
57
    {
58
        $this->options[$option->getName()] = $option;
59
    }
60
61
    public function getDefaultType(): string
62
    {
63
        return $this->defaultType;
64
    }
65
66
    public function setDefaultType(string $defaultType): void
67
    {
68
        $this->defaultType = $defaultType;
69
    }
70
71
    /**
72
     * @return Form[]
73
     */
74
    public function getTypes(): array
75
    {
76
        return $this->types;
77
    }
78
79
    public function addType(Form $type): void
80
    {
81
        $this->types[$type->getName()] = $type;
82
    }
83
84
    public function isRequired(): bool
85
    {
86
        return $this->required;
87
    }
88
89
    public function setRequired(bool $required): void
90
    {
91
        $this->required = $required;
92
    }
93
94
    public function getSpaceAfter(): ?int
95
    {
96
        return $this->spaceAfter;
97
    }
98
99
    public function setSpaceAfter(int $spaceAfter = null): void
100
    {
101
        $this->spaceAfter = $spaceAfter;
102
    }
103
104
    /**
105
     * @return Tag[]
106
     */
107
    public function getTags(): array
108
    {
109
        return $this->tags;
110
    }
111
112
    public function addTag(Tag $tag): void
113
    {
114
        $this->tags[] = $tag;
115
    }
116
}
117