FolderResourceModel   B
last analyzed

Complexity

Total Complexity 42

Size/Duplication

Total Lines 670
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 42
lcom 0
cbo 1
dl 0
loc 670
ccs 105
cts 105
cp 1
rs 8.97
c 0
b 0
f 0

42 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setId() 0 6 1
A getAccountId() 0 4 1
A setAccountId() 0 6 1
A getTitle() 0 4 1
A setTitle() 0 6 1
A getCreatedDate() 0 4 1
A setCreatedDate() 0 6 1
A getUpdatedDate() 0 4 1
A setUpdatedDate() 0 6 1
A getBriefDescription() 0 4 1
A setBriefDescription() 0 6 1
A getDescription() 0 4 1
A setDescription() 0 6 1
A getColor() 0 4 1
A setColor() 0 6 1
A getSharedIds() 0 4 1
A setSharedIds() 0 6 1
A getParentIds() 0 4 1
A setParentIds() 0 6 1
A getChildIds() 0 4 1
A setChildIds() 0 6 1
A getSuperParentIds() 0 4 1
A setSuperParentIds() 0 6 1
A getScope() 0 4 1
A setScope() 0 6 1
A getHasAttachments() 0 4 1
A setHasAttachments() 0 6 1
A getAttachmentCount() 0 4 1
A setAttachmentCount() 0 6 1
A getPermalink() 0 4 1
A setPermalink() 0 6 1
A getWorkflowId() 0 4 1
A setWorkflowId() 0 6 1
A getMetadata() 0 4 1
A setMetadata() 0 6 1
A getCustomFields() 0 4 1
A setCustomFields() 0 6 1
A getCustomColumnIds() 0 4 1
A setCustomColumnIds() 0 6 1
A getProject() 0 4 1
A setProject() 0 6 1

How to fix   Complexity   

Complex Class

Complex classes like FolderResourceModel 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. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.

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 FolderResourceModel, and based on these observations, apply Extract Interface, too.

1
<?php
2
3
/*
4
 * This file is part of the zibios/wrike-php-jmsserializer package.
5
 *
6
 * (c) Zbigniew Ślązak
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Zibios\WrikePhpJmsserializer\Model\Folder;
13
14
use JMS\Serializer\Annotation as SA;
15
use Zibios\WrikePhpJmsserializer\Model\AbstractModel;
16
use Zibios\WrikePhpJmsserializer\Model\Common\CustomFieldModel;
17
use Zibios\WrikePhpJmsserializer\Model\Common\MetadataModel;
18
use Zibios\WrikePhpJmsserializer\Model\Common\ProjectModel;
19
use Zibios\WrikePhpJmsserializer\Model\ResourceModelInterface;
20
21
/**
22
 * Folder Resource Model.
23
 *
24
 * @SuppressWarnings(PHPMD.TooManyFields)
25
 */
26
class FolderResourceModel extends AbstractModel implements ResourceModelInterface
27
{
28
    /**
29
     * Folder ID.
30
     *
31
     * Comment: Folder ID
32
     *
33
     * @SA\Type("string")
34
     * @SA\SerializedName("id")
35
     *
36
     * @var string|null
37
     */
38
    protected $id;
39
40
    /**
41
     * Account ID.
42
     *
43
     * Comment: Account ID
44
     *
45
     * @SA\Type("string")
46
     * @SA\SerializedName("accountId")
47
     *
48
     * @var string|null
49
     */
50
    protected $accountId;
51
52
    /**
53
     * Title.
54
     *
55
     * @SA\Type("string")
56
     * @SA\SerializedName("title")
57
     *
58
     * @var string|null
59
     */
60
    protected $title;
61
62
    /**
63
     * Created date.
64
     *
65
     * Format: yyyy-MM-dd'T'HH:mm:ss'Z'
66
     *
67
     * @SA\Type("string")
68
     * @SA\SerializedName("createdDate")
69
     *
70
     * @var string|null
71
     */
72
    protected $createdDate;
73
74
    /**
75
     * Updated date.
76
     *
77
     * Format: yyyy-MM-dd'T'HH:mm:ss'Z'
78
     *
79
     * @SA\Type("string")
80
     * @SA\SerializedName("updatedDate")
81
     *
82
     * @var string|null
83
     */
84
    protected $updatedDate;
85
86
    /**
87
     * Brief description.
88
     *
89
     * Comment: Optional
90
     *
91
     * @SA\Type("string")
92
     * @SA\SerializedName("briefDescription")
93
     *
94
     * @var string|null
95
     */
96
    protected $briefDescription;
97
98
    /**
99
     * Description.
100
     *
101
     * @SA\Type("string")
102
     * @SA\SerializedName("description")
103
     *
104
     * @var string|null
105
     */
106
    protected $description;
107
108
    /**
109
     * Color.
110
     *
111
     * Folder color, Enum
112
     * Comment: Optional
113
     *
114
     * @SA\Type("string")
115
     * @SA\SerializedName("color")
116
     *
117
     * @var string|null
118
     */
119
    protected $color;
120
121
    /**
122
     * List of user IDs, who share the folder.
123
     *
124
     * Comment: Contact ID list
125
     *
126
     * @SA\Type("array<string>")
127
     * @SA\SerializedName("sharedIds")
128
     *
129
     * @var array|string[]|null
130
     */
131
    protected $sharedIds;
132
133
    /**
134
     * List of parent folder IDs.
135
     *
136
     * Comment: Folder ID list
137
     *
138
     * @SA\Type("array<string>")
139
     * @SA\SerializedName("parentIds")
140
     *
141
     * @var array|string[]|null
142
     */
143
    protected $parentIds;
144
145
    /**
146
     * List of child folder IDs.
147
     *
148
     * Comment: Folder ID list
149
     *
150
     * @SA\Type("array<string>")
151
     * @SA\SerializedName("childIds")
152
     *
153
     * @var array|string[]|null
154
     */
155
    protected $childIds;
156
157
    /**
158
     * List of super parent folder IDs.
159
     *
160
     * Comment: Folder ID list
161
     *
162
     * @SA\Type("array<string>")
163
     * @SA\SerializedName("superParentIds")
164
     *
165
     * @var array|string[]|null
166
     */
167
    protected $superParentIds;
168
169
    /**
170
     * Folder scope.
171
     *
172
     * Folder scope, Enum
173
     *
174
     * @SA\Type("string")
175
     * @SA\SerializedName("scope")
176
     *
177
     * @var string|null
178
     */
179
    protected $scope;
180
181
    /**
182
     * True if folder has attachments.
183
     *
184
     * @SA\Type("boolean")
185
     * @SA\SerializedName("hasAttachments")
186
     *
187
     * @var string|null
188
     */
189
    protected $hasAttachments;
190
191
    /**
192
     * Total count of folder attachments.
193
     *
194
     * Comment: Optional
195
     *
196
     * @SA\Type("integer")
197
     * @SA\SerializedName("attachmentCount")
198
     *
199
     * @var string|null
200
     */
201
    protected $attachmentCount;
202
203
    /**
204
     * Link to open folder in web workspace, if user has appropriate access.
205
     *
206
     * @SA\Type("string")
207
     * @SA\SerializedName("permalink")
208
     *
209
     * @var string|null
210
     */
211
    protected $permalink;
212
213
    /**
214
     * Folder workflow ID.
215
     *
216
     * Comment: Workflow ID
217
     *
218
     * @SA\Type("string")
219
     * @SA\SerializedName("workflowId")
220
     *
221
     * @var string|null
222
     */
223
    protected $workflowId;
224
225
    /**
226
     * List of folder metadata entries.
227
     *
228
     * Metadata entry key-value pair
229
     * Metadata entries are isolated on per-client (application) basis
230
     * Comment: Optional
231
     *
232
     * @SA\Type("array<Zibios\WrikePhpJmsserializer\Model\Common\MetadataModel>")
233
     * @SA\SerializedName("metadata")
234
     *
235
     * @var array|MetadataModel[]|null
236
     */
237
    protected $metadata;
238
239
    /**
240
     * Custom fields.
241
     *
242
     * Comment: Optional
243
     *
244
     * @SA\Type("array<Zibios\WrikePhpJmsserializer\Model\Common\CustomFieldModel>")
245
     * @SA\SerializedName("customFields")
246
     *
247
     * @var array|CustomFieldModel[]|null
248
     */
249
    protected $customFields;
250
251
    /**
252
     * Custom column IDs.
253
     *
254
     * Comment: Optional
255
     * Comment: Custom Field ID
256
     *
257
     * @SA\Type("array<string>")
258
     * @SA\SerializedName("customColumnIds")
259
     *
260
     * @var array|string[]|null
261
     */
262
    protected $customColumnIds;
263
264
    /**
265
     * Project details, present only for project folders.
266
     *
267
     * Comment: Optional
268
     *
269
     * @SA\Type("Zibios\WrikePhpJmsserializer\Model\Common\ProjectModel")
270
     * @SA\SerializedName("project")
271
     *
272
     * @var ProjectModel|null
273
     */
274
    protected $project;
275
276
    /**
277
     * @return null|string
278
     */
279 1
    public function getId()
280
    {
281 1
        return $this->id;
282
    }
283
284
    /**
285
     * @param null|string $id
286
     *
287
     * @return $this
288
     */
289 1
    public function setId($id)
290
    {
291 1
        $this->id = $id;
292
293 1
        return $this;
294
    }
295
296
    /**
297
     * @return null|string
298
     */
299 1
    public function getAccountId()
300
    {
301 1
        return $this->accountId;
302
    }
303
304
    /**
305
     * @param null|string $accountId
306
     *
307
     * @return $this
308
     */
309 1
    public function setAccountId($accountId)
310
    {
311 1
        $this->accountId = $accountId;
312
313 1
        return $this;
314
    }
315
316
    /**
317
     * @return null|string
318
     */
319 1
    public function getTitle()
320
    {
321 1
        return $this->title;
322
    }
323
324
    /**
325
     * @param null|string $title
326
     *
327
     * @return $this
328
     */
329 1
    public function setTitle($title)
330
    {
331 1
        $this->title = $title;
332
333 1
        return $this;
334
    }
335
336
    /**
337
     * @return string|null
338
     */
339 1
    public function getCreatedDate()
340
    {
341 1
        return $this->createdDate;
342
    }
343
344
    /**
345
     * @param string|null $createdDate
346
     *
347
     * @return $this
348
     */
349 1
    public function setCreatedDate($createdDate)
350
    {
351 1
        $this->createdDate = $createdDate;
352
353 1
        return $this;
354
    }
355
356
    /**
357
     * @return string|null
358
     */
359 1
    public function getUpdatedDate()
360
    {
361 1
        return $this->updatedDate;
362
    }
363
364
    /**
365
     * @param string|null $updatedDate
366
     *
367
     * @return $this
368
     */
369 1
    public function setUpdatedDate($updatedDate)
370
    {
371 1
        $this->updatedDate = $updatedDate;
372
373 1
        return $this;
374
    }
375
376
    /**
377
     * @return null|string
378
     */
379 1
    public function getBriefDescription()
380
    {
381 1
        return $this->briefDescription;
382
    }
383
384
    /**
385
     * @param null|string $briefDescription
386
     *
387
     * @return $this
388
     */
389 1
    public function setBriefDescription($briefDescription)
390
    {
391 1
        $this->briefDescription = $briefDescription;
392
393 1
        return $this;
394
    }
395
396
    /**
397
     * @return null|string
398
     */
399 1
    public function getDescription()
400
    {
401 1
        return $this->description;
402
    }
403
404
    /**
405
     * @param null|string $description
406
     *
407
     * @return $this
408
     */
409 1
    public function setDescription($description)
410
    {
411 1
        $this->description = $description;
412
413 1
        return $this;
414
    }
415
416
    /**
417
     * @return null|string
418
     */
419 1
    public function getColor()
420
    {
421 1
        return $this->color;
422
    }
423
424
    /**
425
     * @param null|string $color
426
     *
427
     * @return $this
428
     */
429 1
    public function setColor($color)
430
    {
431 1
        $this->color = $color;
432
433 1
        return $this;
434
    }
435
436
    /**
437
     * @return array|null|\string[]
438
     */
439 1
    public function getSharedIds()
440
    {
441 1
        return $this->sharedIds;
442
    }
443
444
    /**
445
     * @param array|null|\string[] $sharedIds
446
     *
447
     * @return $this
448
     */
449 1
    public function setSharedIds($sharedIds)
450
    {
451 1
        $this->sharedIds = $sharedIds;
452
453 1
        return $this;
454
    }
455
456
    /**
457
     * @return array|null|\string[]
458
     */
459 1
    public function getParentIds()
460
    {
461 1
        return $this->parentIds;
462
    }
463
464
    /**
465
     * @param array|null|\string[] $parentIds
466
     *
467
     * @return $this
468
     */
469 1
    public function setParentIds($parentIds)
470
    {
471 1
        $this->parentIds = $parentIds;
472
473 1
        return $this;
474
    }
475
476
    /**
477
     * @return array|null|\string[]
478
     */
479 1
    public function getChildIds()
480
    {
481 1
        return $this->childIds;
482
    }
483
484
    /**
485
     * @param array|null|\string[] $childIds
486
     *
487
     * @return $this
488
     */
489 1
    public function setChildIds($childIds)
490
    {
491 1
        $this->childIds = $childIds;
492
493 1
        return $this;
494
    }
495
496
    /**
497
     * @return array|null|\string[]
498
     */
499 1
    public function getSuperParentIds()
500
    {
501 1
        return $this->superParentIds;
502
    }
503
504
    /**
505
     * @param array|null|\string[] $superParentIds
506
     *
507
     * @return $this
508
     */
509 1
    public function setSuperParentIds($superParentIds)
510
    {
511 1
        $this->superParentIds = $superParentIds;
512
513 1
        return $this;
514
    }
515
516
    /**
517
     * @return null|string
518
     */
519 1
    public function getScope()
520
    {
521 1
        return $this->scope;
522
    }
523
524
    /**
525
     * @param null|string $scope
526
     *
527
     * @return $this
528
     */
529 1
    public function setScope($scope)
530
    {
531 1
        $this->scope = $scope;
532
533 1
        return $this;
534
    }
535
536
    /**
537
     * @return null|string
538
     */
539 1
    public function getHasAttachments()
540
    {
541 1
        return $this->hasAttachments;
542
    }
543
544
    /**
545
     * @param null|string $hasAttachments
546
     *
547
     * @return $this
548
     */
549 1
    public function setHasAttachments($hasAttachments)
550
    {
551 1
        $this->hasAttachments = $hasAttachments;
552
553 1
        return $this;
554
    }
555
556
    /**
557
     * @return null|string
558
     */
559 1
    public function getAttachmentCount()
560
    {
561 1
        return $this->attachmentCount;
562
    }
563
564
    /**
565
     * @param null|string $attachmentCount
566
     *
567
     * @return $this
568
     */
569 1
    public function setAttachmentCount($attachmentCount)
570
    {
571 1
        $this->attachmentCount = $attachmentCount;
572
573 1
        return $this;
574
    }
575
576
    /**
577
     * @return null|string
578
     */
579 1
    public function getPermalink()
580
    {
581 1
        return $this->permalink;
582
    }
583
584
    /**
585
     * @param null|string $permalink
586
     *
587
     * @return $this
588
     */
589 1
    public function setPermalink($permalink)
590
    {
591 1
        $this->permalink = $permalink;
592
593 1
        return $this;
594
    }
595
596
    /**
597
     * @return null|string
598
     */
599 1
    public function getWorkflowId()
600
    {
601 1
        return $this->workflowId;
602
    }
603
604
    /**
605
     * @param null|string $workflowId
606
     *
607
     * @return $this
608
     */
609 1
    public function setWorkflowId($workflowId)
610
    {
611 1
        $this->workflowId = $workflowId;
612
613 1
        return $this;
614
    }
615
616
    /**
617
     * @return array|null|MetadataModel[]
618
     */
619 1
    public function getMetadata()
620
    {
621 1
        return $this->metadata;
622
    }
623
624
    /**
625
     * @param array|null|MetadataModel[] $metadata
626
     *
627
     * @return $this
628
     */
629 1
    public function setMetadata($metadata)
630
    {
631 1
        $this->metadata = $metadata;
632
633 1
        return $this;
634
    }
635
636
    /**
637
     * @return array|null|CustomFieldModel[]
638
     */
639 1
    public function getCustomFields()
640
    {
641 1
        return $this->customFields;
642
    }
643
644
    /**
645
     * @param array|null|CustomFieldModel[] $customFields
646
     *
647
     * @return $this
648
     */
649 1
    public function setCustomFields($customFields)
650
    {
651 1
        $this->customFields = $customFields;
652
653 1
        return $this;
654
    }
655
656
    /**
657
     * @return array|null|\string[]
658
     */
659 1
    public function getCustomColumnIds()
660
    {
661 1
        return $this->customColumnIds;
662
    }
663
664
    /**
665
     * @param array|null|\string[] $customColumnIds
666
     *
667
     * @return $this
668
     */
669 1
    public function setCustomColumnIds($customColumnIds)
670
    {
671 1
        $this->customColumnIds = $customColumnIds;
672
673 1
        return $this;
674
    }
675
676
    /**
677
     * @return null|ProjectModel
678
     */
679 1
    public function getProject()
680
    {
681 1
        return $this->project;
682
    }
683
684
    /**
685
     * @param null|ProjectModel $project
686
     *
687
     * @return $this
688
     */
689 1
    public function setProject($project)
690
    {
691 1
        $this->project = $project;
692
693 1
        return $this;
694
    }
695
}
696