Completed
Pull Request — develop (#395)
by
unknown
13:13 queued 07:04
created

Field::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Part of JSON definition
4
 */
5
namespace Graviton\GeneratorBundle\Definition\Schema;
6
7
use Graviton\GeneratorBundle\Definition\Schema\XDynamicKey;
8
9
/**
10
 * JSON definition "target.fields"
11
 *
12
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
13
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
14
 * @link     http://swisscom.ch
15
 */
16
class Field
17
{
18
    /**
19
     * @var string
20
     */
21
    private $name;
22
    /**
23
     * @var string
24
     */
25
    private $type;
26
    /**
27
     * @var int
28
     */
29
    private $length;
30
    /**
31
     * @var string
32
     */
33
    private $title;
34
    /**
35
     * @var string
36
     */
37
    private $description;
38
    /**
39
     * @var string
40
     */
41
    private $exposeAs;
42
    /**
43
     * @var bool
44
     */
45
    private $readOnly = false;
46
    /**
47
     * @var bool
48
     */
49
    private $required = false;
50
    /**
51
     * @var bool
52
     */
53
    private $searchable = false;
54
    /**
55
     * @var bool
56
     */
57
    private $translatable = false;
58
    /**
59
     * @var Constraint[]
60
     */
61
    private $constraints = [];
62
63
    /**
64
     * @var array
65
     */
66
    private $collection = [];
67
68
    /**
69
     * @var XDynamicKey
70
     */
71
    private $xDynamicKey;
72
73
    /**
74
     * @return string
75
     */
76 15
    public function getName()
77
    {
78 15
        return $this->name;
79
    }
80
81
    /**
82
     * @param string $name Field name
83
     * @return $this
84
     */
85 8
    public function setName($name)
86
    {
87 8
        $this->name = $name;
88 8
        return $this;
89
    }
90
91
    /**
92
     * @return string
93
     */
94 40
    public function getType()
95
    {
96 40
        return $this->type;
97
    }
98
99
    /**
100
     * @param string $type Field type
101
     * @return $this
102
     */
103 29
    public function setType($type)
104
    {
105 29
        $this->type = $type;
106 29
        return $this;
107
    }
108
109
    /**
110
     * @return int
111
     */
112 8
    public function getLength()
113
    {
114 8
        return $this->length;
115
    }
116
117
    /**
118
     * @param int $length Field length
119
     * @return $this
120
     */
121 2
    public function setLength($length)
122
    {
123 2
        $this->length = $length;
124 2
        return $this;
125
    }
126
127
    /**
128
     * @return string
129
     */
130 11
    public function getTitle()
131
    {
132 11
        return $this->title;
133
    }
134
135
    /**
136
     * @param string $title Field title
137
     * @return $this
138
     */
139 3
    public function setTitle($title)
140
    {
141 3
        $this->title = $title;
142 3
        return $this;
143
    }
144
145
    /**
146
     * @return string
147
     */
148 11
    public function getDescription()
149
    {
150 11
        return $this->description;
151
    }
152
153
    /**
154
     * @param string $description Field description
155
     * @return $this
156
     */
157 6
    public function setDescription($description)
158
    {
159 6
        $this->description = $description;
160 6
        return $this;
161
    }
162
163
    /**
164
     * @return string
165
     */
166 9
    public function getExposeAs()
167
    {
168 9
        return $this->exposeAs;
169
    }
170
171
    /**
172
     * @param string $exposeAs Expose field as ...
173
     * @return $this
174
     */
175 5
    public function setExposeAs($exposeAs)
176
    {
177 5
        $this->exposeAs = $exposeAs;
178 5
        return $this;
179
    }
180
181
    /**
182
     * @return bool
183
     */
184 9
    public function getReadOnly()
0 ignored issues
show
Coding Style introduced by
function getReadOnly() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
185
    {
186 9
        return $this->readOnly;
187
    }
188
189
    /**
190
     * @param bool $readOnly Is field readonly
191
     * @return $this
192
     */
193 3
    public function setReadOnly($readOnly)
194
    {
195 3
        $this->readOnly = $readOnly;
196 3
        return $this;
197
    }
198
199
    /**
200
     * @return bool
201
     */
202 9
    public function getRequired()
0 ignored issues
show
Coding Style introduced by
function getRequired() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
203
    {
204 9
        return $this->required;
205
    }
206
207
    /**
208
     * @param bool $required Is field required
209
     * @return $this
210
     */
211 5
    public function setRequired($required)
212
    {
213 5
        $this->required = $required;
214 5
        return $this;
215
    }
216
217
    /**
218
     * @return bool
219
     */
220 8
    public function getTranslatable()
0 ignored issues
show
Coding Style introduced by
function getTranslatable() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
221
    {
222 8
        return $this->translatable;
223
    }
224
225
    /**
226
     * @param bool $translatable Is field translatable
227
     * @return $this
228
     */
229 2
    public function setTranslatable($translatable)
230
    {
231 2
        $this->translatable = $translatable;
232 2
        return $this;
233
    }
234
235
    /**
236
     * @return Constraint[]
237
     */
238 8
    public function getConstraints()
239
    {
240 8
        return $this->constraints;
241
    }
242
243
    /**
244
     * @param Constraint[] $constraints Field constraints
245
     * @return $this
246
     */
247 2
    public function setConstraints(array $constraints)
248
    {
249 2
        $this->constraints = $constraints;
250 2
        return $this;
251
    }
252
253
    /**
254
     * @return array
255
     */
256 8
    public function getCollection()
257
    {
258 8
        return $this->collection;
259
    }
260
261
    /**
262
     * @param array $collection Field
263
     * @return $this
264
     */
265 2
    public function setCollection(array $collection)
266
    {
267 2
        $this->collection = $collection;
268 2
        return $this;
269
    }
270
271
    /**
272
     * @return XDynamicKey
273
     */
274 8
    public function getXDynamicKey()
275
    {
276 8
        return $this->xDynamicKey;
277
    }
278
279
    /**
280
     * @param XDynamicKey $xDynamicKey x-dynamic-key field value
281
     * @return $this
282
     */
283 1
    public function setXDynamicKey(XDynamicKey $xDynamicKey)
284
    {
285 1
        $this->xDynamicKey = $xDynamicKey;
286 1
        return $this;
287
    }
288
289
    /**
290
     * @return mixed
291
     */
292 9
    public function getSearchable()
0 ignored issues
show
Coding Style introduced by
function getSearchable() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
293
    {
294 9
        return $this->searchable;
295
    }
296
297
    /**
298
     * @param mixed $searchable searchable flag
299
     *
300
     * @return void
301
     */
302
    public function setSearchable($searchable)
303
    {
304
        $this->searchable = $searchable;
305
    }
306
}
307