Completed
Push — master ( 87c59d...6e372e )
by David
03:29 queued 01:52
created

ValidationStatusResponse::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 11
cts 11
cp 1
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 1
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\MailingList;
13
14
use Mailgun\Model\ApiResponse;
15
16
final class ValidationStatusResponse implements ApiResponse
17
{
18
    private $createdAt;
19
    private $downloadUrl;
20
    private $id;
21
    private $quantity;
22
    private $recordsProcessed;
23
    private $status;
24
    private $summary;
25
26 1
    public static function create(array $data): self
27
    {
28 1
        $model = new self();
29 1
        $model->id = $data['id'] ?? null;
30 1
        $model->createdAt = $data['created_at'] ?? null;
31 1
        $model->downloadUrl = ValidationStatusDownloadUrl::create($data['download_url']);
32 1
        $model->id = $data['id'] ?? null;
33 1
        $model->quantity = $data['quantity'] ?? 0;
34 1
        $model->recordsProcessed = $data['records_processed'] ?? null;
35 1
        $model->status = $data['status'] ?? null;
36 1
        $model->summary = ValidationStatusSummary::create($data['summary'] ?? []);
37
38 1
        return $model;
39
    }
40
41 1
    private function __construct()
42
    {
43 1
    }
44
45 1
    public function getCreatedAt(): ?string
46
    {
47 1
        return $this->createdAt;
48
    }
49
50 1
    public function getDownloadUrl(): ValidationStatusDownloadUrl
51
    {
52 1
        return $this->downloadUrl;
53
    }
54
55 1
    public function getId(): ?string
56
    {
57 1
        return $this->id;
58
    }
59
60 1
    public function getQuantity(): ?int
61
    {
62 1
        return $this->quantity;
63
    }
64
65 1
    public function getRecordsProcessed(): ?int
66
    {
67 1
        return $this->recordsProcessed;
68
    }
69
70 1
    public function getStatus(): ?string
71
    {
72 1
        return $this->status;
73
    }
74
75 1
    public function getSummary(): ValidationStatusSummary
76
    {
77 1
        return $this->summary;
78
    }
79
}
80