Completed
Push — master ( 3bc8da...90028d )
by David
24:33
created

IndexResponse   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A create() 0 9 1
A getItems() 0 4 1
A getAssignableToPools() 0 4 1
A getTotalCount() 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\Ip;
13
14
use Mailgun\Model\ApiResponse;
15
16
/**
17
 * @author Tobias Nyholm <[email protected]>
18
 */
19
final class IndexResponse implements ApiResponse
20
{
21
    /**
22
     * @var string[]
23
     */
24
    private $items;
25
26
    /**
27
     * @var int
28
     */
29
    private $totalCount;
30
31 1
    /**
32
     * @var string[]
33 1
     */
34
   private $assignableToPools;
35 1
36
    private function __construct()
37 1
    {
38 1
    }
39 1
40
    public static function create(array $data)
41 1
    {
42
        $model = new self();
43
        $model->items = $data['items'];
44
        $model->totalCount = $data['total_count'] ?? 0;
45
        $model->assignableToPools = $data['assignable_to_pools'];
46
47 1
        return $model;
48
    }
49 1
50
    /**
51
     * @return string[]
52 1
     */
53
    public function getItems(): array
54 1
    {
55
        return $this->items;
56
    }
57
58
    /**
59
     * @return string[]
60
     */
61
    public function getAssignableToPools(): array
62
    {
63
        return $this->assignableToPools;
64
    }
65
66
    public function getTotalCount(): int
67
    {
68
        return $this->totalCount;
69
    }
70
}
71