Passed
Pull Request — master (#132)
by
unknown
15:02 queued 06:44
created

MetadataObject::getMaxInputLength()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 7
nc 3
nop 0
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
<?php
2
namespace EWW\Dpf\Domain\Model;
3
4
/*
5
 * This file is part of the TYPO3 CMS project.
6
 *
7
 * It is free software; you can redistribute it and/or modify it under
8
 * the terms of the GNU General Public License, either version 2
9
 * of the License, or any later version.
10
 *
11
 * For the full copyright and license information, please read the
12
 * LICENSE.txt file that was distributed with this source code.
13
 *
14
 * The TYPO3 project - inspiring people to share!
15
 */
16
17
/**
18
 * MetadataObject
19
 */
20
class MetadataObject extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
21
{
22
23
    /**
24
     * name
25
     *
26
     * @var string
27
     */
28
    protected $name = '';
29
30
    /**
31
     * displayName
32
     *
33
     * @var string
34
     */
35
    protected $displayName = '';
36
37
    /**
38
     * maxIteration
39
     *
40
     * @var integer
41
     */
42
    protected $maxIteration = 0;
43
44
    /**
45
     * mandatory
46
     *
47
     * @var boolean
48
     */
49
    protected $mandatory = false;
50
51
    /**
52
     * mapping
53
     *
54
     * @var string
55
     */
56
    protected $mapping = '';
57
58
    /**
59
     * inputField
60
     *
61
     * @var integer
62
     */
63
    protected $inputField = 0;
64
65
66
    const input    = 0;
67
    const textarea = 1;
68
    const select   = 2;
69
    const checkbox = 3;
70
    const hidden   = 4;
71
    const INPUTDROPDOWN = 100;
72
73
    const INPUT_DATA_TYPE_REGEXP = "REGEXP";
74
    const INPUT_DATA_TYPE_DATE   = "DATE";
75
76
    /**
77
     * dataType
78
     *
79
     * @var string
80
     */
81
    protected $dataType;
82
83
    /**
84
     * modsExtension
85
     *
86
     * @var boolean
87
     */
88
    protected $modsExtension = false;
89
90
    /**
91
     * inputOptionList
92
     *
93
     * @var \EWW\Dpf\Domain\Model\InputOptionList
94
     */
95
    protected $inputOptionList = null;
96
97
    /**
98
     * fillOutService
99
     *
100
     * @var string
101
     */
102
    protected $fillOutService = '';
103
104
    const FILL_OUT_SERVICE_URN = 'urn';
105
    const FILL_OUT_SERVICE_GND = 'gnd';
106
107
    /**
108
     * @var string
109
     */
110
    protected $gndFieldUid = '';
111
112
    /**
113
     * backendOnly
114
     *
115
     * @var boolean
116
     */
117
    protected $backendOnly = false;
118
119
    /**
120
     * consent
121
     *
122
     * @var boolean
123
     */
124
    protected $consent;
125
126
    /**
127
     * defaultValue
128
     *
129
     * @var string
130
     */
131
    protected $defaultValue;
132
133
    /**
134
     * validation
135
     *
136
     * @var string
137
     */
138
    protected $validation = '';
139
140
141
    /**
142
     * max input length
143
     *
144
     * @var integer
145
     */
146
    protected $maxInputLength = 0;
147
148
149
    /**
150
     * Returns the name
151
     *
152
     * @return string $name
153
     */
154
    public function getName()
155
    {
156
        return $this->name;
157
    }
158
159
    /**
160
     * Sets the name
161
     *
162
     * @param string $name
163
     * @return void
164
     */
165
    public function setName($name)
166
    {
167
        $this->name = $name;
168
    }
169
170
    /**
171
     * Returns the displayName
172
     *
173
     * @return string $displayName
174
     */
175
    public function getDisplayName()
176
    {
177
        return $this->displayName;
178
    }
179
180
    /**
181
     * Sets the displayName
182
     *
183
     * @param string $displayName
184
     * @return void
185
     */
186
    public function setDisplayName($displayName)
187
    {
188
        $this->displayName = $displayName;
189
    }
190
191
    /**
192
     * Returns the maxIteration
193
     *
194
     * @return integer $maxIteration
195
     */
196
    public function getMaxIteration()
197
    {
198
        return $this->maxIteration;
199
    }
200
201
    /**
202
     * Sets the maxIteration
203
     *
204
     * @param integer $maxIteration
205
     * @return void
206
     */
207
    public function setMaxIteration($maxIteration)
208
    {
209
        $this->maxIteration = $maxIteration;
210
    }
211
212
    /**
213
     * Returns the mandatory
214
     *
215
     * @return boolean $mandatory
216
     */
217
    public function getMandatory()
218
    {
219
        return $this->mandatory;
220
    }
221
222
    /**
223
     * Sets the mandatory
224
     *
225
     * @param boolean $mandatory
226
     * @return void
227
     */
228
    public function setMandatory($mandatory)
229
    {
230
        $this->mandatory = $mandatory;
231
    }
232
233
    /**
234
     * Returns the boolean state of mandatory
235
     *
236
     * @return boolean
237
     */
238
    public function isMandatory()
239
    {
240
        return $this->mandatory;
241
    }
242
243
    /**
244
     * Returns the modsExtension
245
     *
246
     * @return boolean $modsExtension
247
     */
248
    public function getModsExtension()
249
    {
250
        return $this->modsExtension;
251
    }
252
253
    /**
254
     * Sets the modsExtension
255
     *
256
     * @param boolean $modsExtension
257
     * @return void
258
     */
259
    public function setModsExtension($modsExtension)
260
    {
261
        $this->modsExtension = $modsExtension;
262
    }
263
264
    /**
265
     * Returns the boolean state of modsExtension
266
     *
267
     * @return boolean
268
     */
269
    public function isModsExtension()
270
    {
271
        return $this->modsExtension;
272
    }
273
274
    /**
275
     * Returns the mapping
276
     *
277
     * @return string $mapping
278
     */
279
    public function getMapping()
280
    {
281
        return $this->mapping;
282
    }
283
284
    /**
285
     * Sets the mapping
286
     *
287
     * @param string $mapping
288
     * @return void
289
     */
290
    public function setMapping($mapping)
291
    {
292
        $this->mapping = $mapping;
293
    }
294
295
    /**
296
     * Returns the relative mapping
297
     *
298
     * @return string $relativeMapping
299
     */
300
    public function getRelativeMapping()
301
    {
302
        $modsRegExp = "/^.*?mods:mods/i";
303
        $mapping    = preg_replace($modsRegExp, "", $this->mapping);
304
        return trim($mapping, " /");
305
    }
306
307
    /**
308
     * Returns the inputField
309
     *
310
     * @return integer $inputField
311
     */
312
    public function getInputField()
313
    {
314
        return $this->inputField;
315
    }
316
317
    /**
318
     * Sets the inputField
319
     *
320
     * @param integer $inputField
321
     * @return void
322
     */
323
    public function setInputField($inputField)
324
    {
325
        $this->inputField = $inputField;
326
    }
327
328
    /**
329
     * Returns always NULL because an Object never has children.
330
     *
331
     * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\EWW\Dpf\Domain\Model\MetadataObject> $metadataObject
332
     */
333
    public function getChildren()
334
    {
335
        return null;
336
    }
337
338
    /**
339
     * Returns the inputOptionList
340
     *
341
     * @return \EWW\Dpf\Domain\Model\InputOptionList $inputOptionList
342
     */
343
    public function getInputOptionList()
344
    {
345
        return $this->inputOptionList;
346
    }
347
348
    /**
349
     * Sets the inputOptionList
350
     *
351
     * @param \EWW\Dpf\Domain\Model\InputOptionList $inputOptionList
352
     * @return void
353
     */
354
    public function setInputOptionList(\EWW\Dpf\Domain\Model\InputOptionList $inputOptionList)
355
    {
356
        $this->inputOptionList = $inputOptionList;
357
    }
358
359
    /**
360
     * Returns the fillOutService
361
     *
362
     * @return string $fillOutService
363
     */
364
    public function getFillOutService()
365
    {
366
        return $this->fillOutService;
367
    }
368
369
    /**
370
     * Sets the fillOutService
371
     *
372
     * @param string $fillOutService
373
     * @return void
374
     */
375
    public function setFillOutService($fillOutService)
376
    {
377
        $this->fillOutService = $fillOutService;
378
    }
379
380
    /**
381
     * Returns the backendOnly
382
     *
383
     * @return boolean $backendOnly
384
     */
385
    public function getBackendOnly()
386
    {
387
        return $this->backendOnly;
388
    }
389
390
    /**
391
     * Sets the backendOnly
392
     *
393
     * @param boolean $backendOnly
394
     * @return void
395
     */
396
    public function setBackendOnly($backendOnly)
397
    {
398
        $this->backendOnly = $backendOnly;
399
    }
400
401
    /**
402
     * Returns the consent
403
     *
404
     * @return boolean $consent
405
     */
406
    public function getConsent()
407
    {
408
        return $this->consent;
409
    }
410
411
    /**
412
     * Sets the consent
413
     *
414
     * @param boolean $consent
415
     * @return void
416
     */
417
    public function setConsent($consent)
418
    {
419
        $this->consent = $consent;
420
    }
421
422
    /**
423
     * Returns the defaultValue
424
     *
425
     * @return string $defaultValue
426
     */
427
    public function getDefaultValue()
428
    {
429
        return $this->defaultValue;
430
    }
431
432
    /**
433
     * Sets the defaultValue
434
     *
435
     * @param string $defaultValue
436
     * @return void
437
     */
438
    public function setDefaultValue($defaultValue)
439
    {
440
        $this->defaultValue = $defaultValue;
441
    }
442
443
    /**
444
     * Returns the validation
445
     *
446
     * @return string $validation
447
     */
448
    public function getValidation()
449
    {
450
        return $this->validation;
451
    }
452
453
    /**
454
     * Sets the validation
455
     *
456
     * @param string $validation
457
     * @return void
458
     */
459
    public function setValidation($validation)
460
    {
461
        $this->validation = $validation;
462
    }
463
464
    /**
465
     * Returns the dataType
466
     *
467
     * @return string $dataType
468
     */
469
    public function getDataType()
470
    {
471
        return $this->dataType;
472
    }
473
474
    /**
475
     * Sets the dataType
476
     *
477
     * @param string $dataType
478
     * @return void
479
     */
480
    public function setDataType($dataType)
481
    {
482
        $this->dataType = $dataType;
483
    }
484
485
    /**
486
     * @return string
487
     */
488
    public function getGndFieldUid()
489
    {
490
        return $this->gndFieldUid;
491
    }
492
493
    /**
494
     * @param string $gndFieldUid
495
     */
496
    public function setGndFieldUid($gndFieldUid)
497
    {
498
        $this->gndFieldUid = $gndFieldUid;
499
    }
500
501
    /**
502
     * @return integer
503
     */
504
    public function getMaxInputLength()
505
    {
506
        if ($this->maxInputLength == 0) {
507
            if ($this->inputField == self::input) {
508
                return 255;
509
            } else {
510
                return 2048;
511
            }
512
        } else {
513
            return $this->maxInputLength;
514
        }
515
    }
516
517
    /**
518
     * @return integer
519
     */
520
    public function setMaxInputLength($maxInputLength)
521
    {
522
        $this->maxInputLength = $maxInputLength;
523
    }
524
525
}
526