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

IndexResponse::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\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