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

Requirements   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 0
dl 0
loc 68
ccs 20
cts 20
cp 1
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A createFromArray() 0 11 2
A getCurrentDeadline() 0 4 1
A getCurrentlyDue() 0 4 1
A getDisabledReason() 0 4 1
A getEventuallyDue() 0 4 1
A getPastDue() 0 4 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