Completed
Pull Request — master (#1)
by Romain
02:17
created

Adjustment   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 56
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setName() 0 6 1
A setAmount() 0 6 1
A jsonSerialize() 0 9 1
1
<?php
2
namespace Kerox\Messenger\Model\Message\Attachment\Template\Receipt;
3
4
class Adjustment implements \JsonSerializable
5
{
6
7
    /**
8
     * @var null|string
9
     */
10
    protected $name;
11
12
    /**
13
     * @var null|float
14
     */
15
    protected $amount;
16
17
    /**
18
     * Adjustment constructor.
19
     */
20
    public function __construct()
21
    {
22
        //
23
    }
24
25
    /**
26
     * @param string $name
27
     * @return Adjustment
28
     */
29
    public function setName(string $name): Adjustment
30
    {
31
        $this->name = $name;
32
33
        return $this;
34
    }
35
36
    /**
37
     * @param float $amount
38
     * @return Adjustment
39
     */
40
    public function setAmount(float $amount): Adjustment
41
    {
42
        $this->amount = $amount;
43
44
        return $this;
45
    }
46
47
    /**
48
     * @return array
49
     */
50
    public function jsonSerialize(): array
51
    {
52
        $json = [
53
            'name' => $this->name,
54
            'amount' => $this->amount,
55
        ];
56
57
        return array_filter($json);
58
    }
59
}
60