Completed
Push — master ( a7f8c1...61ae9b )
by David
02:12
created

TotalResponseItem   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 70%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 0
dl 0
loc 49
ccs 14
cts 20
cp 0.7
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 11 2
A __construct() 0 3 1
A getTime() 0 4 1
A getAccepted() 0 4 1
A getDelivered() 0 4 1
A getFailed() 0 4 1
A getComplained() 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\Stats;
13
14
/**
15
 * @author Tobias Nyholm <[email protected]>
16
 */
17
final class TotalResponseItem
18
{
19
    private $time;
20
    private $accepted;
21
    private $delivered;
22
    private $failed;
23
    private $complained;
24
25 4
    public static function create(array $data): self
26
    {
27 4
        $model = new self();
28 4
        $model->time = isset($data['time']) ? new \DateTimeImmutable($data['time']) : null;
29 4
        $model->accepted = $data['accepted'] ?? [];
30 4
        $model->delivered = $data['delivered'] ?? [];
31 4
        $model->failed = $data['failed'] ?? [];
32 4
        $model->complained = $data['complained'] ?? [];
33
34 4
        return $model;
35
    }
36
37 4
    private function __construct()
38
    {
39 4
    }
40
41 1
    public function getTime(): ?\DateTimeImmutable
42
    {
43 1
        return $this->time;
44
    }
45
46
    public function getAccepted(): array
47
    {
48
        return $this->accepted;
49
    }
50
51
    public function getDelivered(): array
52
    {
53
        return $this->delivered;
54
    }
55
56
    public function getFailed(): array
57
    {
58
        return $this->failed;
59
    }
60
61 1
    public function getComplained(): array
62
    {
63 1
        return $this->complained;
64
    }
65
}
66