Tier::getUpTo()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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\Plan;
11
12
use Shapin\Stripe\Model\CreatableFromArray;
13
14
final class Tier implements CreatableFromArray
15
{
16
    /**
17
     * @var int
18
     */
19
    private $flatAmount;
20
21
    /**
22
     * @var int
23
     */
24
    private $unitAmount;
25
26
    /**
27
     * @var int
28
     */
29
    private $upTo;
30
31
    public static function createFromArray(array $data): self
32
    {
33
        $model = new self();
34
        $model->flatAmount = (int) $data['flat_amount'];
35
        $model->unitAmount = (int) $data['unit_amount'];
36
        $model->upTo = (int) $data['up_to'];
37
38
        return $model;
39
    }
40
41
    public function getFlatAmount(): int
42
    {
43
        return $this->flatAmount;
44
    }
45
46
    public function getUnitAmount(): int
47
    {
48
        return $this->unitAmount;
49
    }
50
51
    public function getUpTo(): int
52
    {
53
        return $this->upTo;
54
    }
55
}
56