Passed
Pull Request — master (#83)
by Romain
03:05
created

PriceList   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 52
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

4 Methods

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