Total Complexity | 6 |
Total Lines | 61 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | class PayMethods implements IParam |
||
21 | { |
||
22 | /** |
||
23 | * @var array<PayMethodEnum> |
||
24 | */ |
||
25 | private array $methods; |
||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | private string $string; |
||
30 | |||
31 | |||
32 | /** |
||
33 | * PayMethods constructor. |
||
34 | * |
||
35 | * @param PayMethodEnum ...$methods |
||
36 | */ |
||
37 | 8 | public function __construct(PayMethodEnum ...$methods) |
|
38 | { |
||
39 | 8 | $this->methods = array_unique($methods); |
|
40 | 8 | $this->createString(); |
|
41 | } |
||
42 | |||
43 | /** |
||
44 | * @return string |
||
45 | */ |
||
46 | 8 | public function __toString(): string |
|
47 | { |
||
48 | 8 | return $this->string; |
|
49 | } |
||
50 | |||
51 | /** |
||
52 | * @return string |
||
53 | */ |
||
54 | 6 | public function getParamName(): string |
|
55 | { |
||
56 | 6 | return Param::PAYMETHODS; |
|
57 | } |
||
58 | |||
59 | /** |
||
60 | * @return array<PayMethodEnum> |
||
61 | */ |
||
62 | 3 | public function getValue(): array |
|
63 | { |
||
64 | 3 | return $this->methods; |
|
65 | } |
||
66 | |||
67 | /** |
||
68 | * @param PayMethodEnum $method |
||
69 | */ |
||
70 | 1 | public function addMethod(PayMethodEnum $method): void |
|
71 | { |
||
72 | 1 | $this->methods[] = $method; |
|
73 | 1 | $this->methods = array_unique($this->methods); |
|
74 | 1 | $this->createString(); |
|
75 | } |
||
76 | |||
77 | 8 | private function createString(): void |
|
81 | } |
||
82 | } |
||
83 |