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

GetBulkPreviewsResponse   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 33
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 16 3
A getPreviews() 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
16
final class GetBulkPreviewsResponse implements ApiResponse
17
{
18
    /**
19
     * @var array
20
     */
21
    private $previews = [];
22
23 1
    private function __construct()
24
    {
25 1
    }
26
27 1
    public static function create(array $data): self
28
    {
29 1
        $model = new self();
30
31 1
        $previews = [];
32
33 1
        if (isset($data['previews'])) {
34 1
            foreach ($data['previews'] as $job) {
35 1
                $previews[] = Preview::create($job);
36
            }
37
        }
38
39 1
        $model->previews = $previews;
40
41 1
        return $model;
42
    }
43
44 1
    public function getPreviews(): array
45
    {
46 1
        return $this->previews;
47
    }
48
}
49