EntityVarDatabase   B
last analyzed

Complexity

Total Complexity 44

Size/Duplication

Total Lines 462
Duplicated Lines 0 %

Test Coverage

Coverage 40.37%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 67
c 1
b 0
f 0
dl 0
loc 462
ccs 44
cts 109
cp 0.4037
rs 8.8798
wmc 44

44 Methods

Rating   Name   Duplication   Size   Complexity  
A setDisplayLength() 0 3 1
A getTrimTrailingSpaces() 0 3 1
A setSingleData() 0 3 1
A setRunSequence() 0 3 1
A getName() 0 3 1
A setTrimTrailingSpaces() 0 3 1
A setDataField() 0 3 1
A getcPadding() 0 3 1
A setDatabaseType() 0 3 1
A getPrintAll() 0 3 1
A setPrintAll() 0 3 1
A getCodePage() 0 3 1
A getDisplayLength() 0 3 1
A setDataSource() 0 3 1
A setTable() 0 3 1
A setPrompt() 0 3 1
A setCodePage() 0 3 1
A setRefFileName() 0 3 1
A getDataSource() 0 3 1
A setFixedKeyData() 0 3 1
A getFixedKeyData() 0 3 1
A getKeyField() 0 3 1
A setKeyField() 0 3 1
A setrawBaseData() 0 3 1
A setFixedKey() 0 3 1
A getDataField() 0 3 1
A setcPadding() 0 3 1
A getTable() 0 3 1
A setKeyData() 0 3 1
A getSingleData() 0 3 1
A getDatabaseType() 0 3 1
A getPrompt() 0 3 1
A getActionWhenDone() 0 3 1
A getFixedKey() 0 3 1
A getUsePrompt() 0 3 1
A setActionWhenDone() 0 3 1
A getRefFileName() 0 3 1
A setName() 0 3 1
A setUsePrompt() 0 3 1
A getNumberOfDecimals() 0 3 1
A getKeyData() 0 3 1
A setNumberOfDecimals() 0 3 1
A getRunSequence() 0 3 1
A getrawBaseData() 0 3 1

How to fix   Complexity   

Complex Class

Complex classes like EntityVarDatabase often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.

Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.

While breaking up the class, it is a good idea to analyze how other classes use EntityVarDatabase, and based on these observations, apply Extract Interface, too.

1
<?php
2
/**
3
 * This file is part of graze/unicontroller-client.
4
 *
5
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @license https://github.com/graze/unicontroller-client/blob/master/LICENSE.md
11
 * @link https://github.com/graze/unicontroller-client
12
 */
13
namespace Graze\UnicontrollerClient\Entity\Entity;
14
15
use Graze\UnicontrollerClient\Entity\Entity\EntityInterface;
16
17
class EntityVarDatabase implements EntityInterface
18
{
19
    /**
20
     * @var string
21
     */
22
    protected $name;
23
24
    /**
25
     * @var string
26
     */
27
    protected $dataSource;
28
29
    /**
30
     * @var string
31
     */
32
    protected $refFileName;
33
34
    /**
35
     * @var string
36
     */
37
    protected $table;
38
39
    /**
40
     * @var string
41
     */
42
    protected $keyField;
43
44
    /**
45
     * @var string
46
     */
47
    protected $dataField;
48
49
    /**
50
     * @var string
51
     */
52
    protected $prompt;
53
54
    /**
55
     * @var int
56
     */
57
    protected $displayLength;
58
59
    /**
60
     * @var int
61
     */
62
    protected $trimTrailingSpaces;
63
64
    /**
65
     * @var int
66
     */
67
    protected $printAll;
68
69
    /**
70
     * @var int
71
     */
72
    protected $fixedKey;
73
74
    /**
75
     * @var int
76
     */
77
    protected $singleData;
78
79
    /**
80
     * @var int
81
     */
82
    protected $usePrompt;
83
84
    /**
85
     * @var string
86
     */
87
    protected $keyData;
88
89
    /**
90
     * @var string
91
     */
92
    protected $fixedKeyData;
93
94
    /**
95
     * @var string
96
     */
97
    protected $codePage;
98
99
    /**
100
     * @var int
101
     */
102
    protected $numberOfDecimals;
103
104
    /**
105
     * @var int
106
     */
107
    protected $runSequence;
108
109
    /**
110
     * @var int
111
     */
112
    protected $actionWhenDone;
113
114
    /**
115
     * @var int
116
     */
117
    protected $rawBaseData;
118
119
    /**
120
     * @var int
121
     */
122
    protected $databaseType;
123
124
    /**
125
     * @var int
126
     */
127
    protected $cPadding;
128
129
    /**
130
     * @return string
131
     */
132 1
    public function getName()
133
    {
134 1
        return $this->name;
135
    }
136
137
    /**
138
     * @param string $name
139
     */
140
    public function setName($name)
141
    {
142
        $this->name = $name;
143
    }
144
145
    /**
146
     * @return string
147
     */
148 1
    public function getDataSource()
149
    {
150 1
        return $this->dataSource;
151
    }
152
153
    /**
154
     * @param string $dataSource
155
     */
156
    public function setDataSource($dataSource)
157
    {
158
        $this->dataSource = $dataSource;
159
    }
160
161
    /**
162
     * @return string
163
     */
164 1
    public function getRefFileName()
165
    {
166 1
        return $this->refFileName;
167
    }
168
169
    /**
170
     * @param string $refFileName
171
     */
172
    public function setRefFileName($refFileName)
173
    {
174
        $this->refFileName = $refFileName;
175
    }
176
177
    /**
178
     * @return string
179
     */
180 1
    public function getTable()
181
    {
182 1
        return $this->table;
183
    }
184
185
    /**
186
     * @param string $table
187
     */
188
    public function setTable($table)
189
    {
190
        $this->table = $table;
191
    }
192
193
    /**
194
     * @return string
195
     */
196 1
    public function getKeyField()
197
    {
198 1
        return $this->keyField;
199
    }
200
201
    /**
202
     * @param string $keyField
203
     */
204
    public function setKeyField($keyField)
205
    {
206
        $this->keyField = $keyField;
207
    }
208
209
    /**
210
     * @return string
211
     */
212 1
    public function getDataField()
213
    {
214 1
        return $this->dataField;
215
    }
216
217
    /**
218
     * @param string $dataField
219
     */
220
    public function setDataField($dataField)
221
    {
222
        $this->dataField = $dataField;
223
    }
224
225
    /**
226
     * @return string
227
     */
228 1
    public function getPrompt()
229
    {
230 1
        return $this->prompt;
231
    }
232
233
    /**
234
     * @param string $prompt
235
     */
236
    public function setPrompt($prompt)
237
    {
238
        $this->prompt = $prompt;
239
    }
240
241
    /**
242
     * @return int
243
     */
244 1
    public function getDisplayLength()
245
    {
246 1
        return $this->displayLength;
247
    }
248
249
    /**
250
     * @param int $displayLength
251
     */
252
    public function setDisplayLength($displayLength)
253
    {
254
        $this->displayLength = $displayLength;
255
    }
256
257
    /**
258
     * @return int
259
     */
260 1
    public function getTrimTrailingSpaces()
261
    {
262 1
        return $this->trimTrailingSpaces;
263
    }
264
265
    /**
266
     * @param int $trimTrailingSpaces
267
     */
268
    public function setTrimTrailingSpaces($trimTrailingSpaces)
269
    {
270
        $this->trimTrailingSpaces = $trimTrailingSpaces;
271
    }
272
273
    /**
274
     * @return int
275
     */
276 1
    public function getPrintAll()
277
    {
278 1
        return $this->printAll;
279
    }
280
281
    /**
282
     * @param int $printAll
283
     */
284
    public function setPrintAll($printAll)
285
    {
286
        $this->printAll = $printAll;
287
    }
288
289
    /**
290
     * @return int
291
     */
292 1
    public function getFixedKey()
293
    {
294 1
        return $this->fixedKey;
295
    }
296
297
    /**
298
     * @param int $fixedKey
299
     */
300
    public function setFixedKey($fixedKey)
301
    {
302
        $this->fixedKey = $fixedKey;
303
    }
304
305
    /**
306
     * @return int
307
     */
308 1
    public function getSingleData()
309
    {
310 1
        return $this->singleData;
311
    }
312
313
    /**
314
     * @param int $singleData
315
     */
316
    public function setSingleData($singleData)
317
    {
318
        $this->singleData = $singleData;
319
    }
320
321
    /**
322
     * @return int
323
     */
324 1
    public function getUsePrompt()
325
    {
326 1
        return $this->usePrompt;
327
    }
328
329
    /**
330
     * @param int $usePrompt
331
     */
332
    public function setUsePrompt($usePrompt)
333
    {
334
        $this->usePrompt = $usePrompt;
335
    }
336
337
    /**
338
     * @return string
339
     */
340 1
    public function getKeyData()
341
    {
342 1
        return $this->keyData;
343
    }
344
345
    /**
346
     * @param string $keyData
347
     */
348
    public function setKeyData($keyData)
349
    {
350
        $this->keyData = $keyData;
351
    }
352
353
    /**
354
     * @return string
355
     */
356 1
    public function getFixedKeyData()
357
    {
358 1
        return $this->fixedKeyData;
359
    }
360
361
    /**
362
     * @param string $fixedKeyData
363
     */
364
    public function setFixedKeyData($fixedKeyData)
365
    {
366
        $this->fixedKeyData = $fixedKeyData;
367
    }
368
369
    /**
370
     * @return string
371
     */
372 1
    public function getCodePage()
373
    {
374 1
        return $this->codePage;
375
    }
376
377
    /**
378
     * @param string $codePage
379
     */
380
    public function setCodePage($codePage)
381
    {
382
        $this->codePage = $codePage;
383
    }
384
385
    /**
386
     * @return int
387
     */
388 1
    public function getNumberOfDecimals()
389
    {
390 1
        return $this->numberOfDecimals;
391
    }
392
393
    /**
394
     * @param int $numberOfDecimals
395
     */
396
    public function setNumberOfDecimals($numberOfDecimals)
397
    {
398
        $this->numberOfDecimals = $numberOfDecimals;
399
    }
400
401
    /**
402
     * @return int
403
     */
404 1
    public function getRunSequence()
405
    {
406 1
        return $this->runSequence;
407
    }
408
409
    /**
410
     * @param int $runSequence
411
     */
412
    public function setRunSequence($runSequence)
413
    {
414
        $this->runSequence = $runSequence;
415
    }
416
417
    /**
418
     * @return int
419
     */
420 1
    public function getActionWhenDone()
421
    {
422 1
        return $this->actionWhenDone;
423
    }
424
425
    /**
426
     * @param int $actionWhenDone
427
     */
428
    public function setActionWhenDone($actionWhenDone)
429
    {
430
        $this->actionWhenDone = $actionWhenDone;
431
    }
432
433
    /**
434
     * @return int
435
     */
436 1
    public function getrawBaseData()
437
    {
438 1
        return $this->rawBaseData;
439
    }
440
441
    /**
442
     * @param int $rawBaseData
443
     */
444
    public function setrawBaseData($rawBaseData)
445
    {
446
        $this->rawBaseData = $rawBaseData;
447
    }
448
449
    /**
450
     * @return int
451
     */
452 1
    public function getDatabaseType()
453
    {
454 1
        return $this->databaseType;
455
    }
456
457
    /**
458
     * @param int $databaseType
459
     */
460
    public function setDatabaseType($databaseType)
461
    {
462
        $this->databaseType = $databaseType;
463
    }
464
465
    /**
466
     * @return int
467
     */
468 1
    public function getcPadding()
469
    {
470 1
        return $this->cPadding;
471
    }
472
473
    /**
474
     * @param int $cPadding
475
     */
476
    public function setcPadding($cPadding)
477
    {
478
        $this->cPadding = $cPadding;
479
    }
480
}
481