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

ParseResponse::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\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