Completed
Push — master ( 66fd85...a39d0b )
by Tobias
04:24 queued 03:10
created

TotalResponseItem::getStored()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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
    private $opened;
25 4
    private $clicked;
26
    private $unsubscribed;
27 4
    private $stored;
28 4
29 4
    public static function create(array $data): self
30 4
    {
31 4
        $model = new self();
32 4
        $model->time = isset($data['time']) ? new \DateTimeImmutable($data['time']) : null;
33
        $model->accepted = $data['accepted'] ?? [];
34 4
        $model->delivered = $data['delivered'] ?? [];
35
        $model->failed = $data['failed'] ?? [];
36
        $model->complained = $data['complained'] ?? [];
37 4
        $model->opened = $data['opened'] ?? [];
38
        $model->clicked = $data['clicked'] ?? [];
39 4
        $model->unsubscribed = $data['unsubscribed'] ?? [];
40
        $model->stored = $data['stored'] ?? [];
41 1
42
        return $model;
43 1
    }
44
45
    private function __construct()
46
    {
47
    }
48
49
    public function getTime(): ?\DateTimeImmutable
50
    {
51
        return $this->time;
52
    }
53
54
    public function getAccepted(): array
55
    {
56
        return $this->accepted;
57
    }
58
59
    public function getDelivered(): array
60
    {
61 1
        return $this->delivered;
62
    }
63 1
64
    public function getFailed(): array
65
    {
66
        return $this->failed;
67
    }
68
69
    public function getComplained(): array
70
    {
71
        return $this->complained;
72
    }
73
74
    public function getOpened(): array
75
    {
76
        return $this->opened;
77
    }
78
79
    public function getClicked(): array
80
    {
81
        return $this->clicked;
82
    }
83
84
    public function getUnsubscribed(): array
85
    {
86
        return $this->unsubscribed;
87
    }
88
89
    public function getStored(): array
90
    {
91
        return $this->stored;
92
    }
93
}
94