Completed
Push — master ( bdfee2...e6cd81 )
by Olivier
02:17
created

Requirements::getCurrentDeadline()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
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
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Shapin\Stripe\Model\Account;
11
12
use Shapin\Stripe\Model\CreatableFromArray;
13
14
final class Requirements implements CreatableFromArray
15
{
16
    /**
17
     * @var ?\DateTimeImmutable
18
     */
19
    private $currentDeadline;
20
21
    /**
22
     * @var array
23
     */
24
    private $currentlyDue;
25
26
    /**
27
     * @var ?string
28
     */
29
    private $disabledReason;
30
31
    /**
32
     * @var array
33
     */
34
    private $eventuallyDue;
35
36
    /**
37
     * @var array
38
     */
39
    private $pastDue;
40
41 4
    private function __construct()
42
    {
43 4
    }
44
45 4
    public static function createFromArray(array $data)
46
    {
47 4
        $model = new self();
48 4
        $model->currentDeadline = isset($data['current_deadline']) ? new \DateTimeImmutable('@'.$data['current_deadline']) : null;
49 4
        $model->currentlyDue = $data['currently_due'];
50 4
        $model->disabledReason = $data['disabled_reason'];
51 4
        $model->eventuallyDue = $data['eventually_due'];
52 4
        $model->pastDue = $data['past_due'];
53
54 4
        return $model;
55
    }
56
57 1
    public function getCurrentDeadline(): ?\DateTimeImmutable
58
    {
59 1
        return $this->currentDeadline;
60
    }
61
62 1
    public function getCurrentlyDue(): array
63
    {
64 1
        return $this->currentlyDue;
65
    }
66
67 1
    public function getDisabledReason(): ?string
68
    {
69 1
        return $this->disabledReason;
70
    }
71
72 1
    public function getEventuallyDue(): array
73
    {
74 1
        return $this->eventuallyDue;
75
    }
76
77 1
    public function getPastDue(): array
78
    {
79 1
        return $this->pastDue;
80
    }
81
}
82