Completed
Push — master ( 14a2bb...4a945d )
by Andrii
02:47
created

Charge::getId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\billing\charge;
12
13
use hiqdev\php\billing\action\ActionInterface;
14
use hiqdev\php\billing\target\TargetInterface;
15
use hiqdev\php\billing\type\TypeInterface;
16
use hiqdev\php\units\QuantityInterface;
17
use Money\Money;
18
19
/**
20
 * Charge.
21
 *
22
 * [[Action]] is charged with a number of [[Charge]]s.
23
 *
24
 * @author Andrii Vasyliev <[email protected]>
25
 */
26
class Charge implements \JsonSerializable
27
{
28
    /**
29
     * @var int
30
     */
31
    protected $id;
32
33
    /**
34
     * @var ActionInterface
35
     */
36
    protected $action;
37
38
    /**
39
     * @var TypeInterface
40
     */
41
    protected $type;
42
43
    /**
44
     * @var TargetInterface
45
     */
46
    protected $target;
47
48
    /**
49
     * @var QuantityInterface
50
     */
51
    protected $usage;
52
53
    /**
54
     * @var Money
55
     */
56
    protected $sum;
57
58 2
    public function __construct(
59
                            $id,
60
        ActionInterface     $action,
61
        TypeInterface       $type,
62
        TargetInterface     $target,
63
        QuantityInterface   $usage,
64
        Money               $sum
65
    ) {
66 2
        $this->id       = $id;
67 2
        $this->action   = $action;
68 2
        $this->type     = $type;
69 2
        $this->target   = $target;
70 2
        $this->usage    = $usage;
71 2
        $this->sum      = $sum;
72 2
    }
73
74
    public function getId()
75
    {
76
        return $this->id;
77
    }
78
79 2
    public function getAction()
80
    {
81 2
        return $this->action;
82
    }
83
84 2
    public function getTarget()
85
    {
86 2
        return $this->target;
87
    }
88
89 2
    public function getType()
90
    {
91 2
        return $this->type;
92
    }
93
94 2
    public function getUsage()
95
    {
96 2
        return $this->usage;
97
    }
98
99 2
    public function getSum()
100
    {
101 2
        return $this->sum;
102
    }
103
    public function jsonSerialize()
104
    {
105
        return get_object_vars($this);
106
    }
107
}
108