Completed
Push — feature/EVO-5751-mongodb-3.x ( f7410f...d456eb )
by Lucas
67:06 queued 60:09
created

Field::getXDynamicKey()   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

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
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 $recordOriginException = false;
50
    /**
51
     * @var bool
52
     */
53
    private $required = false;
54
    /**
55
     * @var integer
56
     */
57
    private $searchable = 0;
58
    /**
59
     * @var bool
60
     */
61
    private $translatable = false;
62
    /**
63
     * @var Constraint[]
64
     */
65
    private $constraints = [];
66
67
    /**
68
     * @var array
69
     */
70
    private $collection = [];
71
72
    /**
73
     * @var XDynamicKey
74
     */
75
    private $xDynamicKey;
76
77
    /**
78
     * @return string
79
     */
80 30
    public function getName()
81
    {
82 30
        return $this->name;
83
    }
84
85
    /**
86
     * @param string $name Field name
87
     * @return $this
88
     */
89 16
    public function setName($name)
90
    {
91 16
        $this->name = $name;
92 16
        return $this;
93
    }
94
95
    /**
96
     * @return string
97
     */
98 80
    public function getType()
99
    {
100 80
        return $this->type;
101
    }
102
103
    /**
104
     * @param string $type Field type
105
     * @return $this
106
     */
107 58
    public function setType($type)
108
    {
109 58
        $this->type = $type;
110 58
        return $this;
111
    }
112
113
    /**
114
     * @return int
115
     */
116 16
    public function getLength()
117
    {
118 16
        return $this->length;
119
    }
120
121
    /**
122
     * @param int $length Field length
123
     * @return $this
124
     */
125 4
    public function setLength($length)
126
    {
127 4
        $this->length = $length;
128 4
        return $this;
129
    }
130
131
    /**
132
     * @return string
133
     */
134 22
    public function getTitle()
135
    {
136 22
        return $this->title;
137
    }
138
139
    /**
140
     * @param string $title Field title
141
     * @return $this
142
     */
143 6
    public function setTitle($title)
144
    {
145 6
        $this->title = $title;
146 6
        return $this;
147
    }
148
149
    /**
150
     * @return string
151
     */
152 22
    public function getDescription()
153
    {
154 22
        return $this->description;
155
    }
156
157
    /**
158
     * @param string $description Field description
159
     * @return $this
160
     */
161 12
    public function setDescription($description)
162
    {
163 12
        $this->description = $description;
164 12
        return $this;
165
    }
166
167
    /**
168
     * @return string
169
     */
170 18
    public function getExposeAs()
171
    {
172 18
        return $this->exposeAs;
173
    }
174
175
    /**
176
     * @param string $exposeAs Expose field as ...
177
     * @return $this
178
     */
179 10
    public function setExposeAs($exposeAs)
180
    {
181 10
        $this->exposeAs = $exposeAs;
182 10
        return $this;
183
    }
184
185
    /**
186
     * @return bool
187
     */
188 18
    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...
189
    {
190 18
        return $this->readOnly;
191
    }
192
193
    /**
194
     * @param bool $readOnly Is field readonly
195
     * @return $this
196
     */
197 6
    public function setReadOnly($readOnly)
198
    {
199 6
        $this->readOnly = $readOnly;
200 6
        return $this;
201
    }
202
203
    /**
204
     * get RecordOriginException
205
     *
206
     * @return boolean RecordOriginException
207
     */
208 16
    public function isRecordOriginException()
209
    {
210 16
        return $this->recordOriginException;
211
    }
212
213
    /**
214
     * set RecordOriginException
215
     *
216
     * @param boolean $recordOriginException recordOriginException
217
     *
218
     * @return void
219
     */
220
    public function setRecordOriginException($recordOriginException)
221
    {
222
        $this->recordOriginException = $recordOriginException;
223
    }
224
225
    /**
226
     * @return bool
227
     */
228 20
    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...
229
    {
230 20
        return $this->required;
231
    }
232
233
    /**
234
     * @param bool $required Is field required
235
     * @return $this
236
     */
237 10
    public function setRequired($required)
238
    {
239 10
        $this->required = $required;
240 10
        return $this;
241
    }
242
243
    /**
244
     * @return bool
245
     */
246 16
    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...
247
    {
248 16
        return $this->translatable;
249
    }
250
251
    /**
252
     * @param bool $translatable Is field translatable
253
     * @return $this
254
     */
255 4
    public function setTranslatable($translatable)
256
    {
257 4
        $this->translatable = $translatable;
258 4
        return $this;
259
    }
260
261
    /**
262
     * @return Constraint[]
263
     */
264 18
    public function getConstraints()
265
    {
266 18
        return $this->constraints;
267
    }
268
269
    /**
270
     * @param Constraint[] $constraints Field constraints
271
     * @return $this
272
     */
273 4
    public function setConstraints(array $constraints)
274
    {
275 4
        $this->constraints = $constraints;
276 4
        return $this;
277
    }
278
279
    /**
280
     * @return array
281
     */
282 16
    public function getCollection()
283
    {
284 16
        return $this->collection;
285
    }
286
287
    /**
288
     * @param array $collection Field
289
     * @return $this
290
     */
291 4
    public function setCollection(array $collection)
292
    {
293 4
        $this->collection = $collection;
294 4
        return $this;
295
    }
296
297
    /**
298
     * @return XDynamicKey
299
     */
300 16
    public function getXDynamicKey()
301
    {
302 16
        return $this->xDynamicKey;
303
    }
304
305
    /**
306
     * @param XDynamicKey $xDynamicKey x-dynamic-key field value
307
     * @return $this
308
     */
309 2
    public function setXDynamicKey(XDynamicKey $xDynamicKey)
310
    {
311 2
        $this->xDynamicKey = $xDynamicKey;
312 2
        return $this;
313
    }
314
315
    /**
316
     * @return integer
317
     */
318 18
    public function getSearchable()
319
    {
320 18
        return (int) $this->searchable;
321
    }
322
323
    /**
324
     * @param integer $searchable searchable flag
325
     *
326
     * @return void
327
     */
328
    public function setSearchable($searchable)
329
    {
330
        $this->searchable = (int) $searchable;
331
    }
332
}
333