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\TaxRate; |
11
|
|
|
|
12
|
|
|
use Shapin\Stripe\Model\ContainsMetadata; |
13
|
|
|
use Shapin\Stripe\Model\CreatableFromArray; |
14
|
|
|
use Shapin\Stripe\Model\LivemodeTrait; |
15
|
|
|
use Shapin\Stripe\Model\MetadataTrait; |
16
|
|
|
use Shapin\Stripe\Model\MetadataCollection; |
17
|
|
|
|
18
|
|
|
final class TaxRate implements CreatableFromArray, ContainsMetadata |
19
|
|
|
{ |
20
|
|
|
use LivemodeTrait, MetadataTrait; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
private $id; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var bool |
29
|
|
|
*/ |
30
|
|
|
private $isActive; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var \DateTimeImmutable |
34
|
|
|
*/ |
35
|
|
|
private $createdAt; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var ?string |
39
|
|
|
*/ |
40
|
|
|
private $description; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string |
44
|
|
|
*/ |
45
|
|
|
private $displayName; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var bool |
49
|
|
|
*/ |
50
|
|
|
private $isInclusive; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var ?string |
54
|
|
|
*/ |
55
|
|
|
private $jurisdiction; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var float |
59
|
|
|
*/ |
60
|
|
|
private $percentage; |
61
|
|
|
|
62
|
2 |
|
public static function createFromArray(array $data): self |
63
|
|
|
{ |
64
|
2 |
|
$model = new self(); |
65
|
|
|
|
66
|
2 |
|
$model->id = $data['id']; |
67
|
2 |
|
$model->isActive = (bool) $data['active']; |
68
|
2 |
|
$model->createdAt = new \DateTimeImmutable('@'.$data['created']); |
69
|
2 |
|
$model->description = $data['description']; |
70
|
2 |
|
$model->displayName = $data['display_name']; |
71
|
2 |
|
$model->isInclusive = (bool) $data['inclusive']; |
72
|
2 |
|
$model->jurisdiction = $data['jurisdiction']; |
73
|
2 |
|
$model->live = $data['livemode']; |
74
|
2 |
|
$model->metadata = MetadataCollection::createFromArray($data['metadata']); |
|
|
|
|
75
|
2 |
|
$model->percentage = $data['percentage']; |
76
|
|
|
|
77
|
2 |
|
return $model; |
78
|
|
|
} |
79
|
|
|
|
80
|
1 |
|
public function getId(): string |
81
|
|
|
{ |
82
|
1 |
|
return $this->id; |
83
|
|
|
} |
84
|
|
|
|
85
|
1 |
|
public function isActive(): bool |
86
|
|
|
{ |
87
|
1 |
|
return $this->isActive; |
88
|
|
|
} |
89
|
|
|
|
90
|
1 |
|
public function getCreatedAt(): \DateTimeImmutable |
91
|
|
|
{ |
92
|
1 |
|
return $this->createdAt; |
93
|
|
|
} |
94
|
|
|
|
95
|
1 |
|
public function getDescription(): ?string |
96
|
|
|
{ |
97
|
1 |
|
return $this->description; |
98
|
|
|
} |
99
|
|
|
|
100
|
1 |
|
public function getDisplayName(): string |
101
|
|
|
{ |
102
|
1 |
|
return $this->displayName; |
103
|
|
|
} |
104
|
|
|
|
105
|
1 |
|
public function isInclusive(): bool |
106
|
|
|
{ |
107
|
1 |
|
return $this->isInclusive; |
108
|
|
|
} |
109
|
|
|
|
110
|
1 |
|
public function getJurisdiction(): ?string |
111
|
|
|
{ |
112
|
1 |
|
return $this->jurisdiction; |
113
|
|
|
} |
114
|
|
|
|
115
|
1 |
|
public function getPercentage(): float |
116
|
|
|
{ |
117
|
1 |
|
return $this->percentage; |
118
|
|
|
} |
119
|
|
|
} |
120
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..