Passed
Push — master ( 6e710f...a80202 )
by Andrii
12:46
created

Usage::amount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace hiqdev\php\billing\usage;
5
6
use DateTimeImmutable;
7
use hiqdev\php\billing\target\TargetInterface;
8
use hiqdev\php\billing\type\TypeInterface;
9
use hiqdev\php\units\Quantity;
10
11
/**
12
 * Class Usage represents a consumption of some metered resource $type at $time
13
 * by the $target with the given $amount.
14
 *
15
 * @author Dmytro Naumenko <[email protected]>
16
 */
17
class Usage implements UsageInterface
18
{
19
    private TargetInterface $target;
20
    private DateTimeImmutable $time;
21
    private TypeInterface $type;
22
    private Quantity $amount;
23
24
    public function __construct(TargetInterface $target, DateTimeImmutable $time, TypeInterface $type, Quantity $amount)
25
    {
26
        $this->target = $target;
27
        $this->time = $time;
28
        $this->type = $type;
29
        $this->amount = $amount;
30
    }
31
32
    public function target(): TargetInterface
33
    {
34
        return $this->target;
35
    }
36
37
    public function time(): DateTimeImmutable
38
    {
39
        return $this->time;
40
    }
41
42
    public function type(): TypeInterface
43
    {
44
        return $this->type;
45
    }
46
47
    public function amount(): Quantity
48
    {
49
        return $this->amount;
50
    }
51
}
52