formWasSent = true; $this->fieldTarget = (string) $_POST['target']; $this->fieldAmount = (string) $_POST['amount']; $this->fieldText = (string) $_POST['text']; } } public function renderErrors(): string { $errors = []; if ($this->errorTargetNotFound) { $errors[] = '[!] Der angegebene Nutzername (Zielkonto) konnte nicht gefunden werden.'; } if ($this->errorAmountInvalid) { $errors[] = '[!] Der eingegebene Betrag entspricht nicht dem vorgesehenen Format.'; } if ($this->errorAmountZero) { $errors[] = '[!] Der Betrag muss größer als 0,00 € sein.'; } if ($this->errorInsufficientFunds) { $errors[] = '[!] Dein Konto ist nicht ausreichend gedeckt.'; } if ($this->errorTextTooLong) { $errors[] = '[!] Der Buchungstext darf nicht länger als 100 Zeichen sein.'; } return implode('
', $errors); } public function sendTitle(): void { echo 'Überweisen'; } public function sendMainContent(): void { $target = htmlspecialchars($this->fieldTarget); $amount = htmlspecialchars($this->fieldAmount); $text = htmlspecialchars($this->fieldText); echo "

Überweisen

"; $errors = $this->renderErrors(); if (!empty($errors)) { echo "

{$errors}

"; } if ($this->success) { $successTarget = htmlspecialchars($this->successTarget); $successAmount = MoneyFormatter::formatAmount($this->successAmount); echo "

Es wurden {$successAmount} an {$successTarget} überwiesen.

"; } echo "
context->currentPage}\" method=\"post\">"; echo "
"; echo "
"; echo "
"; echo ""; echo '
'; } }