Completed
Push — master ( 43a76d...75ce5f )
by David
01:41
created

GetBulkJobsResponse   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 87.5%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 2
dl 0
loc 47
ccs 14
cts 16
cp 0.875
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 18 3
A getTotal() 0 4 1
A getJobs() 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\EmailValidationV4;
13
14
use Mailgun\Model\ApiResponse;
15
use Mailgun\Model\PaginationResponse;
16
17
final class GetBulkJobsResponse implements ApiResponse
18
{
19
    use PaginationResponse;
20
21
    /**
22
     * @var int
23
     */
24
    private $total = 0;
25
26
    /**
27
     * @var array
28
     */
29
    private $jobs = [];
30
31 1
    private function __construct()
32
    {
33 1
    }
34
35 1
    public static function create(array $data): self
36
    {
37 1
        $model = new self();
38
39 1
        $jobs = [];
40
41 1
        if (isset($data['jobs'])) {
42 1
            foreach ($data['jobs'] as $job) {
43 1
                $jobs[] = Job::create($job);
44
            }
45
        }
46
47 1
        $model->jobs = $jobs;
48 1
        $model->total = $data['total'] ?? 0;
49 1
        $model->paging = $data['paging'];
50
51 1
        return $model;
52
    }
53
54
    public function getTotal(): int
55
    {
56
        return $this->total;
57
    }
58
59 1
    public function getJobs(): array
60
    {
61 1
        return $this->jobs;
62
    }
63
}
64