Completed
Push — master ( 43a76d...75ce5f )
by David
01:41
created

Summary   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 36
loc 36
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 9 9 1
A __construct() 3 3 1
A getResult() 4 4 1
A getRisk() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * Copyright (C) 2013 Mailgun
7
 *
8
 * This software may be modified and distributed under the terms
9
 * of the MIT license. See the LICENSE file for details.
10
 */
11
12
namespace Mailgun\Model\EmailValidationV4;
13
14
use Mailgun\Model\ApiResponse;
15
16 View Code Duplication
final class Summary implements ApiResponse
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    /**
19
     * @var SummaryResult
20
     */
21
    private $result;
22
23
    /**
24
     * @var SummaryRisk
25
     */
26
    private $risk;
27
28 7
    public static function create(array $data): self
29
    {
30 7
        $model = new self();
31
32 7
        $model->result = SummaryResult::create($data['result']);
0 ignored issues
show
Documentation Bug introduced by
It seems like \Mailgun\Model\EmailVali...create($data['result']) of type object<self> is incompatible with the declared type object<Mailgun\Model\Ema...dationV4\SummaryResult> of property $result.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
33 7
        $model->risk = SummaryRisk::create($data['risk']);
0 ignored issues
show
Documentation Bug introduced by
It seems like \Mailgun\Model\EmailVali...::create($data['risk']) of type object<self> is incompatible with the declared type object<Mailgun\Model\Ema...lidationV4\SummaryRisk> of property $risk.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
34
35 7
        return $model;
36
    }
37
38 7
    private function __construct()
39
    {
40 7
    }
41
42 1
    public function getResult(): SummaryResult
43
    {
44 1
        return $this->result;
45
    }
46
47 1
    public function getRisk(): SummaryRisk
48
    {
49 1
        return $this->risk;
50
    }
51
}
52