Issues (113)

src/charge/derivative/ChargeDerivativeQuery.php (1 issue)

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-2020, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\billing\charge\derivative;
12
13
use hiqdev\php\billing\action\ActionInterface;
14
use hiqdev\php\billing\bill\BillInterface;
15
use hiqdev\php\billing\charge\ChargeInterface;
16
use hiqdev\php\billing\price\PriceInterface;
17
use hiqdev\php\billing\target\TargetInterface;
18
use hiqdev\php\billing\type\TypeInterface;
0 ignored issues
show
The type hiqdev\php\billing\type\TypeInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
19
use hiqdev\php\units\QuantityInterface;
20
use Money\Money;
21
22
/**
23
 * Class ChargeDerivativeQuery
24
 *
25
 * @author Dmytro Naumenko <[email protected]>
26
 */
27
final class ChargeDerivativeQuery implements ChargeDerivativeQueryInterface
28
{
29
    private $changed = [];
30
31
    public function get(string $name, $default = null)
32
    {
33
        return $this->isChanged($name)
34
            ? $this->changed[$name]
35
            : $default;
36
    }
37
38
    public function changeId($id): ChargeDerivativeQueryInterface
39
    {
40
        $this->changed['id'] = $id;
41
42
        return $this;
43
    }
44
45
    public function changeType(TypeInterface $type): ChargeDerivativeQueryInterface
46
    {
47
        $this->changed['type'] = $type;
48
49
        return $this;
50
    }
51
52
    public function changeTarget(TargetInterface $target): ChargeDerivativeQueryInterface
53
    {
54
        $this->changed['target'] = $target;
55
56
        return $this;
57
    }
58
59
    public function changeAction(ActionInterface $action): ChargeDerivativeQueryInterface
60
    {
61
        $this->changed['action'] = $action;
62
63
        return $this;
64
    }
65
66
    public function changePrice(PriceInterface $price): ChargeDerivativeQueryInterface
67
    {
68
        $this->changed['price'] = $price;
69
70
        return $this;
71
    }
72
73
    public function changeUsage(QuantityInterface $quantity): ChargeDerivativeQueryInterface
74
    {
75
        $this->changed['usage'] = $quantity;
76
77
        return $this;
78
    }
79
80
    public function changeSum(Money $sum): ChargeDerivativeQueryInterface
81
    {
82
        $this->changed['sum'] = $sum;
83
84
        return $this;
85
    }
86
87
    public function changeBill(BillInterface $bill): ChargeDerivativeQueryInterface
88
    {
89
        $this->changed['bill'] = $bill;
90
91
        return $this;
92
    }
93
94
    public function changeComment(?string $comment): ChargeDerivativeQueryInterface
95
    {
96
        $this->changed['comment'] = $comment;
97
98
        return $this;
99
    }
100
101
    public function changeParent(?ChargeInterface $charge): ChargeDerivativeQueryInterface
102
    {
103
        $this->changed['parent'] = $charge;
104
105
        return $this;
106
    }
107
108
    public function isChanged(string $field): bool
109
    {
110
        return isset($this->changed[$field]);
111
    }
112
113
    public function getParent(): ?ChargeInterface
114
    {
115
        return $this->get('parent');
116
    }
117
118
    public function getId()
119
    {
120
        return $this->get('id');
121
    }
122
123
    public function getUsage(): ?QuantityInterface
124
    {
125
        return $this->get('usage');
126
    }
127
128
    public function getType(): ?TypeInterface
129
    {
130
        return $this->get('type');
131
    }
132
133
    public function getComment(): ?string
134
    {
135
        return $this->get('comment');
136
    }
137
138
    public function getSum(): ?Money
139
    {
140
        return $this->get('sum');
141
    }
142
143
    public function getAction(): ?ActionInterface
144
    {
145
        return $this->get('action');
146
    }
147
148
    public function getBill(): ?BillInterface
149
    {
150
        return $this->get('bill');
151
    }
152
153
    public function getPrice(): ?PriceInterface
154
    {
155
        return $this->get('price');
156
    }
157
158
    public function getTarget(): ?TargetInterface
159
    {
160
        return $this->get('target');
161
    }
162
}
163