| Total Complexity | 5 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | class Payer |
||
| 18 | { |
||
| 19 | /** |
||
| 20 | * array |
||
| 21 | */ |
||
| 22 | public const OPTIONS = [ |
||
| 23 | 'SENDER', |
||
| 24 | 'RECIPIENT', |
||
| 25 | 'THIRD_PARTY' |
||
| 26 | ]; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var string |
||
| 30 | * @Serializer\Type("string") |
||
| 31 | */ |
||
| 32 | private string $value; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param string $value |
||
| 36 | */ |
||
| 37 | 3 | public function __construct(string $value) |
|
| 38 | { |
||
| 39 | 3 | $this->setValue($value); |
|
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @param string $value |
||
| 44 | * @return void |
||
| 45 | */ |
||
| 46 | 3 | public function setValue(string $value): void |
|
| 47 | { |
||
| 48 | 3 | if (! in_array($value, self::OPTIONS, true)) { |
|
| 49 | 1 | throw new \InvalidArgumentException(); |
|
| 50 | } |
||
| 51 | 2 | $this->value = $value; |
|
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return string |
||
| 56 | */ |
||
| 57 | 1 | public function getValue(): string |
|
| 58 | { |
||
| 59 | 1 | return $this->value; |
|
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @return string |
||
| 64 | */ |
||
| 65 | 1 | public function __toString(): string |
|
| 68 | } |
||
| 69 | } |
||
| 70 |