Completed
Branch master (5acf81)
by Steevan
04:21
created

FormOptionsBuilder::setAutoInitialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace steevanb\SymfonyFormOptionsBuilder\FormOptionsBuilder;
4
5
use steevanb\SymfonyFormOptionsBuilder\Behavior;
6
7
class FormOptionsBuilder implements FormOptionsBuilderInterface
8
{
9
    use Behavior\OptionTrait;
10
    use Behavior\AllowExtraFieldsTrait;
11
    use Behavior\ExtraFieldsMessageTrait;
12
    use Behavior\AttrTrait;
13
    use Behavior\BlockNameTrait;
14
    use Behavior\ByReferenceTrait;
15
    use Behavior\CompoundTrait;
16
    use Behavior\ConstraintsTrait;
17
    use Behavior\DataTrait;
18
    use Behavior\DataClassTrait;
19
    use Behavior\DisabledTrait;
20
    use Behavior\EmptyDataTrait;
21
    use Behavior\ErrorBubblingTrait;
22
    use Behavior\InheritDataTrait;
23
    use Behavior\InvalidMessageTrait;
24
    use Behavior\InvalidMessageParametersTrait;
25
    use Behavior\LabelTrait;
26
    use Behavior\LabelAttrTrait;
27
    use Behavior\LabelFormatTrait;
28
    use Behavior\MappedTrait;
29
    use Behavior\PropertyPathTrait;
30
    use Behavior\RequiredTrait;
31
    use Behavior\TranslationDomainTrait;
32
    use Behavior\TrimTrait;
33
    use Behavior\ValidationGroupsTrait;
34
35
    /**
36
     * @return $this
37
     */
38
    public static function create()
39
    {
40
        return new static();
41
    }
42
43
    /**
44
     * @return array
45
     */
46
    public function asArray()
47
    {
48
        return $this->options;
49
    }
50
51
    /**
52
     * @param string $action
53
     * @return $this
54
     * @link http://symfony.com/doc/current/reference/forms/types/form.html#action
55
     */
56
    public function setAction($action)
57
    {
58
        return $this->setOption('action', $action);
59
    }
60
61
    /**
62
     * @return string
63
     * @link http://symfony.com/doc/current/reference/forms/types/form.html#action
64
     */
65
    public function getAction()
66
    {
67
        return $this->getOption('action');
68
    }
69
70
    /**
71
     * @return $this
72
     * @link http://symfony.com/doc/current/reference/forms/types/form.html#action
73
     */
74
    public function removeAction()
75
    {
76
        return $this->removeOption('action');
77
    }
78
79
    /**
80
     * @param bool $auto
81
     * @return $this
82
     * @link http://symfony.com/doc/current/reference/forms/types/form.html#auto-initialize
83
     */
84
    public function setAutoInitialize($auto = true)
85
    {
86
        return $this->setOption('auto_initialize', $auto);
87
    }
88
89
    /**
90
     * @return bool|string
91
     * @link http://symfony.com/doc/current/reference/forms/types/form.html#auto-initialize
92
     */
93
    public function getAutoInitialize()
94
    {
95
        return $this->getOption('auto_initialize');
96
    }
97
98
    /**
99
     * @return $this
100
     * @link http://symfony.com/doc/current/reference/forms/types/form.html#auto-initialize
101
     */
102
    public function removeAutoInitialize()
103
    {
104
        return $this->removeOption('auto_initialize');
105
    }
106
107
    /**
108
     * @param array $mapping
109
     * @return $this
110
     * @link http://symfony.com/doc/current/reference/forms/types/form.html#error-mapping
111
     */
112
    public function setErrorMapping(array $mapping)
113
    {
114
        return $this->setOption('error_mapping', $mapping);
115
    }
116
117
    /**
118
     * @return array|string
119
     * @link http://symfony.com/doc/current/reference/forms/types/form.html#error-mapping
120
     */
121
    public function getErrorMapping()
122
    {
123
        return $this->getOption('error_mapping');
124
    }
125
126
    /**
127
     * @return $this
128
     * @link http://symfony.com/doc/current/reference/forms/types/form.html#error-mapping
129
     */
130
    public function removeErrorMapping()
131
    {
132
        return $this->removeOption('error_mapping');
133
    }
134
135
    /**
136
     * @param string $intention
137
     * @return $this
138
     * @link http://symfony.com/doc/current/book/forms.html#csrf-protection
139
     */
140
    public function setIntention($intention)
141
    {
142
        return $this->setOption('intention', $intention);
143
    }
144
145
    /**
146
     * @return $this
147
     * @link http://symfony.com/doc/current/book/forms.html#csrf-protection
148
     */
149
    public function getIntention()
150
    {
151
        return $this->getOption('intention');
152
    }
153
154
    /**
155
     * @return $this
156
     * @link http://symfony.com/doc/current/book/forms.html#csrf-protection
157
     */
158
    public function removeIntention()
159
    {
160
        return $this->removeOption('intention');
161
    }
162
}
163