Completed
Push — master ( a1ca1a...6a943d )
by David
01:56
created

Parse::create()   A

Complexity

Conditions 5
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 30

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 0
cts 4
cp 0
rs 9.6111
c 0
b 0
f 0
cc 5
nc 1
nop 1
crap 30
1
<?php
2
3
/*
4
 * Copyright (C) 2013 Mailgun
5
 *
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Mailgun\Model\EmailValidation;
11
12
/**
13
 * @author David Garcia <[email protected]>
14
 */
15
final class Parse
16
{
17
    /**
18
     * @var array
19
     */
20
    private $parsed;
21
22
    /**
23
     * @var array
24
     */
25
    private $unparseable;
26
27
    /**
28
     * Parse constructor.
29
     *
30
     * @param array $parsed
31
     * @param array $unparseable
32
     */
33
    private function __construct(array $parsed, array $unparseable)
34
    {
35
        $this->parsed = $parsed;
36
        $this->unparseable = $unparseable;
37
    }
38
39
    /**
40
     * @param array $data
41
     *
42
     * @return Parse
43
     */
44
    public static function create(array $data)
45
    {
46
        return new self(
47
            ((isset($data['parsed']) && is_array($data['parsed'])) ? $data['parsed'] : []),
48
            ((isset($data['unparseable']) && is_array($data['unparseable'])) ? $data['unparseable'] : [])
49
        );
50
    }
51
52
    /**
53
     * @return array
54
     */
55
    public function getParsed()
56
    {
57
        return $this->parsed;
58
    }
59
60
    /**
61
     * @return array
62
     */
63
    public function getUnparseable()
64
    {
65
        return $this->unparseable;
66
    }
67
}
68