StatementBill   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 96
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 33
c 1
b 0
f 0
dl 0
loc 96
rs 10
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 38 1
A getPrepaid() 0 3 1
A getMonth() 0 3 1
A getOveruse() 0 3 1
A getPrice() 0 3 1
A getTariffType() 0 3 1
A getFrom() 0 3 1
A getUniqueObjectsCount() 0 3 1
1
<?php
2
/**
3
 * PHP Billing Library
4
 *
5
 * @link      https://github.com/hiqdev/php-billing
6
 * @package   php-billing
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2021, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\billing\statement;
12
13
use hiqdev\php\billing\bill\Bill;
14
use hiqdev\php\billing\bill\BillInterface;
15
use hiqdev\php\billing\bill\BillState;
16
use hiqdev\php\billing\type\TypeInterface;
17
use hiqdev\php\billing\customer\CustomerInterface;
18
use hiqdev\php\billing\target\TargetInterface;
19
use hiqdev\php\billing\plan\PlanInterface;
20
use hiqdev\php\units\QuantityInterface;
21
use DateTimeImmutable;
22
use Money\Money;
23
24
/**
25
 * StatementBill.
26
 *
27
 * @author Yurii Myronchuk <[email protected]>
28
 */
29
class StatementBill extends Bill implements StatementBillInterface
30
{
31
    /** @var DateTimeImmutable */
32
    protected $month;
33
34
    /** @var Money */
35
    protected $price;
36
37
    /** @var Money */
38
    protected $overuse;
39
40
    /** @var QuantityInterface */
41
    protected $prepaid;
42
43
    /** @var string */
44
    protected $from;
45
46
    /** @var int */
47
    protected int $unique_objects_count = 0;
48
49
    /** @var TypeInterface */
50
    protected $tariff_type;
51
52
    public function __construct(
53
        $id,
54
        TypeInterface $type,
55
        DateTimeImmutable $time,
56
        Money $sum,
57
        QuantityInterface $quantity,
58
        CustomerInterface $customer,
59
        DateTimeImmutable $month,
60
        int $unique_objects_count,
61
        Money $price = null,
62
        Money $overuse = null,
63
        QuantityInterface $prepaid = null,
64
        array $charges = [],
65
        TargetInterface $target = null,
66
        PlanInterface $plan = null,
67
        BillState $state = null,
68
        ?string $from = null,
69
        TypeInterface $tariff_type = null
70
    ) {
71
        parent::__construct(
72
            $id,
73
            $type,
74
            $time,
75
            $sum,
76
            $quantity,
77
            $customer,
78
            $target,
79
            $plan,
80
            $charges,
81
            $state
82
        );
83
        $this->month                = $month;
84
        $this->unique_objects_count = $unique_objects_count;
85
        $this->price                = $price;
86
        $this->overuse              = $overuse;
87
        $this->prepaid              = $prepaid;
88
        $this->from                 = $from;
89
        $this->tariff_type          = $tariff_type;
90
    }
91
92
    public function getMonth(): DateTimeImmutable
93
    {
94
        return $this->month;
95
    }
96
97
    public function getFrom(): ?string
98
    {
99
        return $this->from;
100
    }
101
102
    public function getPrice(): ?Money
103
    {
104
        return $this->price;
105
    }
106
107
    public function getOveruse(): ?Money
108
    {
109
        return $this->overuse;
110
    }
111
112
    public function getPrepaid(): QuantityInterface
113
    {
114
        return $this->prepaid;
115
    }
116
117
    public function getTariffType(): ?TypeInterface
118
    {
119
        return $this->tariff_type;
120
    }
121
122
    public function getUniqueObjectsCount(): int
123
    {
124
        return $this->unique_objects_count;
125
    }
126
}
127