Test Failed
Push — master ( 156c37...627d8f )
by Zbigniew
03:20
created

FolderResourceModel   B

Complexity

Total Complexity 42

Size/Duplication

Total Lines 670
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

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