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

Parse   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 0
dl 0
loc 53
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A create() 0 7 5
A getParsed() 0 4 1
A getUnparseable() 0 4 1
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