GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

CollectSslResult   B
last analyzed

Complexity

Total Complexity 51

Size/Duplication

Total Lines 593
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 51
lcom 1
cbo 1
dl 0
loc 593
rs 7.92
c 0
b 0
f 0

44 Methods

Rating   Name   Duplication   Size   Complexity  
A getCaCertificate() 0 23 5
A setCaCertificate() 0 6 1
A getCertificate() 0 18 4
A setCertificate() 0 6 1
A getCertificateStatus() 0 4 1
A setCertificateStatus() 0 6 1
A getCsrStatus() 0 4 1
A setCsrStatus() 0 6 1
A getDcvStatus() 0 4 1
A setDcvStatus() 0 6 1
A getEvClickThroughStatus() 0 4 1
A setEvClickThroughStatus() 0 6 1
A getFqdn() 0 4 1
A setFqdn() 0 6 1
A getFreeDVUPStatus() 0 4 1
A setFreeDVUPStatus() 0 6 1
A getMdcDomainDetails() 0 4 1
A setMdcDomainDetails() 0 6 1
A getMdcDomainDetails2() 0 4 1
A setMdcDomainDetails2() 0 6 1
A getNetscapeCertificateSequence() 0 4 1
A setNetscapeCertificateSequence() 0 6 1
A getNotAfter() 0 4 1
A setNotAfter() 0 6 1
A getNotBefore() 0 4 1
A setNotBefore() 0 6 1
A getOrderNumber() 0 4 1
A setOrderNumber() 0 6 1
A getErrorCode() 0 4 1
A setErrorCode() 0 6 1
A getOrganizationValidationStatus() 0 4 1
A setOrganizationValidationStatus() 0 6 1
A getOvCallBackStatus() 0 4 1
A setOvCallBackStatus() 0 6 1
A getPkcs7() 0 4 1
A setPkcs7() 0 6 1
A getValidationStatus() 0 4 1
A setValidationStatus() 0 6 1
A getZipFile() 0 4 1
A setZipFile() 0 6 1
A addDelimiter() 0 9 1
A wrapCrt() 0 6 1
A getBrandValStatus() 0 4 1
A setBrandValStatus() 0 6 1

How to fix   Complexity   

Complex Class

Complex classes like CollectSslResult 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 CollectSslResult, and based on these observations, apply Extract Interface, too.

1
<?php
2
namespace Checkdomain\Comodo\Model\Result;
3
4
/**
5
 * Class CollectSslResult
6
 */
7
class CollectSslResult extends AbstractResult
8
{
9
    /**
10
     * @var integer
11
     */
12
    protected $orderNumber;
13
14
    /**
15
     * @var integer
16
     */
17
    protected $errorCode;
18
19
    /**
20
     * @var \DateTime
21
     */
22
    protected $notBefore;
23
24
    /**
25
     * @var \DateTime
26
     */
27
    protected $notAfter;
28
29
    /**
30
     * @var string
31
     */
32
    protected $fqdn;
33
34
    /**
35
     * @var string
36
     */
37
    protected $zipFile;
38
39
    /**
40
     * @var string
41
     */
42
    protected $netscapeCertificateSequence;
43
44
    /**
45
     * @var string
46
     */
47
    protected $pkcs7;
48
49
    /**
50
     * @var array
51
     */
52
    protected $caCertificate;
53
54
    /**
55
     * @var string
56
     */
57
    protected $certificate;
58
59
    /**
60
     * @var string
61
     */
62
    protected $certificateStatus;
63
64
    /**
65
     * @var string
66
     */
67
    protected $validationStatus;
68
69
    /**
70
     * @var string
71
     */
72
    protected $mdcDomainDetails;
73
74
    /**
75
     * @var string
76
     */
77
    protected $mdcDomainDetails2;
78
79
    /**
80
     * @var integer
81
     */
82
    protected $csrStatus;
83
84
    /**
85
     * @var integer
86
     */
87
    protected $dcvStatus;
88
89
    /**
90
     * @var integer
91
     */
92
    protected $ovCallBackStatus;
93
94
    /**
95
     * @var integer
96
     */
97
    protected $organizationValidationStatus;
98
99
    /**
100
     * @var integer
101
     */
102
    protected $freeDVUPStatus;
103
104
    /**
105
     * @var integer
106
     */
107
    protected $evClickThroughStatus;
108
109
    /**
110
     * @var integer
111
     */
112
    protected $brandValStatus;
113
114
    /**
115
     * @param bool $wrapCrt
116
     * @param bool $addDelimiter
117
     *
118
     * @return array|null
119
     */
120
    public function getCaCertificate($wrapCrt = true, $addDelimiter = true)
121
    {
122
        $crt = $this->caCertificate;
123
124
        if ($crt === null) {
125
            return null;
126
        }
127
128
        foreach ($crt as $i => $val) {
129
            if ($wrapCrt) {
130
                $crt[$i] = $this->wrapCrt($crt[$i]);
131
            }
132
133
            if ($addDelimiter) {
134
                $crt[$i] = $this->addDelimiter($crt[$i]);
135
            }
136
        }
137
138
        // This is the right order
139
        $crt = array_reverse($crt);
140
141
        return $crt;
142
    }
143
144
    /**
145
     * @param array $caCertificate
146
     *
147
     * @return CollectSslResult
148
     */
149
    public function setCaCertificate($caCertificate)
150
    {
151
        $this->caCertificate = $caCertificate;
152
153
        return $this;
154
    }
155
156
    /**
157
     * @param bool $wrapCrt
158
     * @param bool $addDelimiter
159
     *
160
     * @return string|null
161
     */
162
    public function getCertificate($wrapCrt = true, $addDelimiter = true)
163
    {
164
        $crt = $this->certificate;
165
166
        if ($crt === null) {
167
            return null;
168
        }
169
170
        if ($addDelimiter) {
171
            $crt = $this->addDelimiter($crt);
172
        }
173
174
        if ($wrapCrt) {
175
            $crt = $this->wrapCrt($crt);
176
        }
177
178
        return $crt;
179
    }
180
181
    /**
182
     * @param string $certificate
183
     *
184
     * @return CollectSslResult
185
     */
186
    public function setCertificate($certificate)
187
    {
188
        $this->certificate = $certificate;
189
190
        return $this;
191
    }
192
193
    /**
194
     * @return string
195
     */
196
    public function getCertificateStatus()
197
    {
198
        return $this->certificateStatus;
199
    }
200
201
    /**
202
     * @param string $certificateStatus
203
     *
204
     * @return CollectSslResult
205
     */
206
    public function setCertificateStatus($certificateStatus)
207
    {
208
        $this->certificateStatus = $certificateStatus;
209
210
        return $this;
211
    }
212
213
    /**
214
     * @return int
215
     */
216
    public function getCsrStatus()
217
    {
218
        return $this->csrStatus;
219
    }
220
221
    /**
222
     * @param int $csrStatus
223
     *
224
     * @return CollectSslResult
225
     */
226
    public function setCsrStatus($csrStatus)
227
    {
228
        $this->csrStatus = $csrStatus;
229
230
        return $this;
231
    }
232
233
    /**
234
     * @return int
235
     */
236
    public function getDcvStatus()
237
    {
238
        return $this->dcvStatus;
239
    }
240
241
    /**
242
     * @param int $dcvStatus
243
     *
244
     * @return CollectSslResult
245
     */
246
    public function setDcvStatus($dcvStatus)
247
    {
248
        $this->dcvStatus = $dcvStatus;
249
250
        return $this;
251
    }
252
253
    /**
254
     * @return int
255
     */
256
    public function getEvClickThroughStatus()
257
    {
258
        return $this->evClickThroughStatus;
259
    }
260
261
    /**
262
     * @param int $evClickThroughStatus
263
     *
264
     * @return CollectSslResult
265
     */
266
    public function setEvClickThroughStatus($evClickThroughStatus)
267
    {
268
        $this->evClickThroughStatus = $evClickThroughStatus;
269
270
        return $this;
271
    }
272
273
    /**
274
     * @return int
275
     */
276
    public function getBrandValStatus()
277
    {
278
        return $this->brandValStatus;
279
    }
280
281
    /**
282
     * @param int $brandValStatus
283
     *
284
     * @return CollectSslResult
285
     */
286
    public function setBrandValStatus($brandValStatus)
287
    {
288
        $this->brandValStatus = $brandValStatus;
289
290
        return $this;
291
    }
292
293
    /**
294
     * @return string
295
     */
296
    public function getFqdn()
297
    {
298
        return $this->fqdn;
299
    }
300
301
    /**
302
     * @param string $fqdn
303
     *
304
     * @return CollectSslResult
305
     */
306
    public function setFqdn($fqdn)
307
    {
308
        $this->fqdn = $fqdn;
309
310
        return $this;
311
    }
312
313
    /**
314
     * @return int
315
     */
316
    public function getFreeDVUPStatus()
317
    {
318
        return $this->freeDVUPStatus;
319
    }
320
321
    /**
322
     * @param int $freeDVUPStatus
323
     *
324
     * @return CollectSslResult
325
     */
326
    public function setFreeDVUPStatus($freeDVUPStatus)
327
    {
328
        $this->freeDVUPStatus = $freeDVUPStatus;
329
330
        return $this;
331
    }
332
333
    /**
334
     * @return string
335
     */
336
    public function getMdcDomainDetails()
337
    {
338
        return $this->mdcDomainDetails;
339
    }
340
341
    /**
342
     * @param string $mdcDomainDetails
343
     *
344
     * @return CollectSslResult
345
     */
346
    public function setMdcDomainDetails($mdcDomainDetails)
347
    {
348
        $this->mdcDomainDetails = $mdcDomainDetails;
349
350
        return $this;
351
    }
352
353
    /**
354
     * @return string
355
     */
356
    public function getMdcDomainDetails2()
357
    {
358
        return $this->mdcDomainDetails2;
359
    }
360
361
    /**
362
     * @param string $mdcDomainDetails2
363
     *
364
     * @return CollectSslResult
365
     */
366
    public function setMdcDomainDetails2($mdcDomainDetails2)
367
    {
368
        $this->mdcDomainDetails2 = $mdcDomainDetails2;
369
370
        return $this;
371
    }
372
373
    /**
374
     * @return string
375
     */
376
    public function getNetscapeCertificateSequence()
377
    {
378
        return $this->netscapeCertificateSequence;
379
    }
380
381
    /**
382
     * @param string $netscapeCertificateSequence
383
     *
384
     * @return CollectSslResult
385
     */
386
    public function setNetscapeCertificateSequence($netscapeCertificateSequence)
387
    {
388
        $this->netscapeCertificateSequence = $netscapeCertificateSequence;
389
390
        return $this;
391
    }
392
393
    /**
394
     * @return \DateTime
395
     */
396
    public function getNotAfter()
397
    {
398
        return $this->notAfter;
399
    }
400
401
    /**
402
     * @param \DateTime $notAfter
403
     *
404
     * @return CollectSslResult
405
     */
406
    public function setNotAfter($notAfter)
407
    {
408
        $this->notAfter = $notAfter;
409
410
        return $this;
411
    }
412
413
    /**
414
     * @return \DateTime
415
     */
416
    public function getNotBefore()
417
    {
418
        return $this->notBefore;
419
    }
420
421
    /**
422
     * @param \DateTime $notBefore
423
     *
424
     * @return CollectSslResult
425
     */
426
    public function setNotBefore($notBefore)
427
    {
428
        $this->notBefore = $notBefore;
429
430
        return $this;
431
    }
432
433
    /**
434
     * @return int
435
     */
436
    public function getOrderNumber()
437
    {
438
        return $this->orderNumber;
439
    }
440
441
    /**
442
     * @param int $orderNumber
443
     *
444
     * @return CollectSslResult
445
     */
446
    public function setOrderNumber($orderNumber)
447
    {
448
        $this->orderNumber = $orderNumber;
449
450
        return $this;
451
    }
452
453
    /**
454
     * @return int
455
     */
456
    public function getErrorCode()
457
    {
458
        return $this->errorCode;
459
    }
460
461
    /**
462
     * @param int $errorCode
463
     *
464
     * @return $this
465
     */
466
    public function setErrorCode($errorCode)
467
    {
468
        $this->errorCode = $errorCode;
469
470
        return $this;
471
    }
472
473
    /**
474
     * @return int
475
     */
476
    public function getOrganizationValidationStatus()
477
    {
478
        return $this->organizationValidationStatus;
479
    }
480
481
    /**
482
     * @param int $organizationValidationStatus
483
     *
484
     * @return CollectSslResult
485
     */
486
    public function setOrganizationValidationStatus($organizationValidationStatus)
487
    {
488
        $this->organizationValidationStatus = $organizationValidationStatus;
489
490
        return $this;
491
    }
492
493
    /**
494
     * @return int
495
     */
496
    public function getOvCallBackStatus()
497
    {
498
        return $this->ovCallBackStatus;
499
    }
500
501
    /**
502
     * @param int $ovCallBackStatus
503
     *
504
     * @return CollectSslResult
505
     */
506
    public function setOvCallBackStatus($ovCallBackStatus)
507
    {
508
        $this->ovCallBackStatus = $ovCallBackStatus;
509
510
        return $this;
511
    }
512
513
    /**
514
     * @return string
515
     */
516
    public function getPkcs7()
517
    {
518
        return $this->pkcs7;
519
    }
520
521
    /**
522
     * @param string $pkcs7
523
     *
524
     * @return CollectSslResult
525
     */
526
    public function setPkcs7($pkcs7)
527
    {
528
        $this->pkcs7 = $pkcs7;
529
530
        return $this;
531
    }
532
533
    /**
534
     * @return string
535
     */
536
    public function getValidationStatus()
537
    {
538
        return $this->validationStatus;
539
    }
540
541
    /**
542
     * @param string $validationStatus
543
     *
544
     * @return CollectSslResult
545
     */
546
    public function setValidationStatus($validationStatus)
547
    {
548
        $this->validationStatus = $validationStatus;
549
550
        return $this;
551
    }
552
553
    /**
554
     * @return string
555
     */
556
    public function getZipFile()
557
    {
558
        return $this->zipFile;
559
    }
560
561
    /**
562
     * @param string $zipFile
563
     *
564
     * @return CollectSslResult
565
     */
566
    public function setZipFile($zipFile)
567
    {
568
        $this->zipFile = $zipFile;
569
570
        return $this;
571
    }
572
573
    /**
574
     * @param string $crtContent
575
     *
576
     * @return string
577
     */
578
    protected function addDelimiter($crtContent)
579
    {
580
        $crtContent =
581
            '-----BEGIN CERTIFICATE-----'.chr(10).
582
            $crtContent.chr(10).
583
            '-----END CERTIFICATE-----';
584
585
        return $crtContent;
586
    }
587
588
    /**
589
     * @param string $crtContent
590
     *
591
     * @return string
592
     */
593
    protected function wrapCrt($crtContent)
594
    {
595
        $crtContent = wordwrap($crtContent, 64, chr(10), true);
596
597
        return $crtContent;
598
    }
599
}
600