Lines
100.00%
23 / 23
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 19 / 19 | 100.00% | 1 / 1 | 1 | ||
| normalize | 100.00% | 4 / 4 | 100.00% | 1 / 1 | 3 | ||
| 15 | final readonly class MailContent | |
| 16 | { | |
| 17 | public ?Money $money; | |
| 18 | ||
| 19 | public ?DateTimeImmutable $transactionDate; | |
| 20 | ||
| 21 | public ?string $accountNumber; | |
| 22 | ||
| 23 | public ?string $sourceAccountNumber; | |
| 24 | ||
| 25 | /** | |
| 26 | * The account at the bank that sent the mail (ČSOB SK `na účte`, VÚB `Na účet`). | |
| 27 | * `$accountNumber` stays the payer account, as in 4.x. | |
| 28 | */ | |
| 29 | public ?string $ownAccountNumber; | |
| 30 | ||
| 31 | public ?string $vs; | |
| 32 | ||
| 33 | public ?string $ss; | |
| 34 | ||
| 35 | public ?string $ks; | |
| 36 | ||
| 37 | public ?string $receiverMessage; | |
| 38 | ||
| 39 | public ?string $description; | |
| 40 | ||
| 41 | public ?string $cid; | |
| 42 | ||
| 43 | public ?string $sign; | |
| 44 | ||
| 45 | public ?string $res; | |
| 46 | ||
| 47 | public ?string $ac; | |
| 48 | ||
| 49 | public ?string $cc; | |
| 50 | ||
| 51 | public ?string $tid; | |
| 52 | ||
| 53 | public ?string $txn; | |
| 54 | ||
| 55 | public ?string $rc; | |
| 56 | ||
| 57 | public ?string $tres; | |
| 58 | ||
| 59 | public function __construct( | |
| 60 | ?Money $money = null, | |
| 61 | ?DateTimeImmutable $transactionDate = null, | |
| 62 | ?string $accountNumber = null, | |
| 63 | ?string $sourceAccountNumber = null, | |
| 64 | ?string $ownAccountNumber = null, | |
| 65 | ?string $vs = null, | |
| 66 | ?string $ss = null, | |
| 67 | ?string $ks = null, | |
| 68 | ?string $receiverMessage = null, | |
| 69 | ?string $description = null, | |
| 70 | ?string $cid = null, | |
| 71 | ?string $sign = null, | |
| 72 | ?string $res = null, | |
| 73 | ?string $ac = null, | |
| 74 | ?string $cc = null, | |
| 75 | ?string $tid = null, | |
| 76 | ?string $txn = null, | |
| 77 | ?string $rc = null, | |
| 78 | ?string $tres = null, | |
| 79 | ) { | |
| 80 | $this->money = $money; | |
| 81 | $this->transactionDate = $transactionDate; | |
| 82 | $this->accountNumber = self::normalize($accountNumber); | |
| 83 | $this->sourceAccountNumber = self::normalize($sourceAccountNumber); | |
| 84 | $this->ownAccountNumber = self::normalize($ownAccountNumber); | |
| 85 | $this->vs = self::normalize($vs); | |
| 86 | $this->ss = self::normalize($ss); | |
| 87 | $this->ks = self::normalize($ks); | |
| 88 | $this->receiverMessage = self::normalize($receiverMessage); | |
| 89 | $this->description = self::normalize($description); | |
| 90 | $this->cid = self::normalize($cid); | |
| 91 | $this->sign = self::normalize($sign); | |
| 92 | $this->res = self::normalize($res); | |
| 93 | $this->ac = self::normalize($ac); | |
| 94 | $this->cc = self::normalize($cc); | |
| 95 | $this->tid = self::normalize($tid); | |
| 96 | $this->txn = self::normalize($txn); | |
| 97 | $this->rc = self::normalize($rc); | |
| 98 | $this->tres = self::normalize($tres); | |
| 99 | } | |
| 100 | ||
| 101 | private static function normalize(?string $value): ?string | |
| 102 | { | |
| 103 | if ($value === null) { | |
| 104 | return null; | |
| 105 | } | |
| 106 | ||
| 107 | $value = mb_trim($value, " \t\n\r\0\x0B\u{00A0}\u{2009}\u{202F}"); | |
| 108 | ||
| 109 | return $value === '' ? null : $value; | |
| 110 | } | |
| 111 | } |