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

Summary::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 9
loc 9
ccs 5
cts 5
cp 1
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
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