Completed
Push — master ( 2b60fb...0f5433 )
by David
02:06
created

ParseResponse   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 0
dl 0
loc 35
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 8 5
A getParsed() 0 4 1
A getUnparseable() 0 4 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\EmailValidation;
13
14
use Mailgun\Model\ApiResponse;
15
16
/**
17
 * @author David Garcia <[email protected]>
18
 */
19
final class ParseResponse implements ApiResponse
20
{
21
    /**
22
     * @var array
23
     */
24
    private $parsed;
25
26
    /**
27
     * @var array
28
     */
29
    private $unparseable;
30
31 3
    private function __construct()
32
    {
33 3
    }
34
35 3
    public static function create(array $data): self
36
    {
37 3
        $model = new self();
38 3
        $model->parsed = (isset($data['parsed']) && is_array($data['parsed'])) ? $data['parsed'] : [];
39 3
        $model->unparseable = (isset($data['unparseable']) && is_array($data['unparseable'])) ? $data['unparseable'] : [];
40
41 3
        return $model;
42
    }
43
44 3
    public function getParsed(): array
45
    {
46 3
        return $this->parsed;
47
    }
48
49 3
    public function getUnparseable(): array
50
    {
51 3
        return $this->unparseable;
52
    }
53
}
54