- Mehrfach-Upload von PDF-Kontoauszügen mit automatischer Metadaten-Erkennung - Dashboard mit Übersichts-Widgets (letzte Buchungen und Kontoauszüge) - Menü-Integration unter "Banken und Kasse" statt eigenem Top-Menü - Erinnerungsfunktion bei veralteten Kontoauszügen (konfigurierbar) - Verknüpfung von Buchungen mit PDF-Kontoauszügen - Auszugsnummer wird automatisch aus dem Zeitraum abgeleitet (Monat/Jahr) - Jahrfilter zeigt nur Jahre mit vorhandenen Kontoauszügen - Modul-Icon auf fa-money-check-alt gesetzt - README und ChangeLog aktualisiert - .gitignore für Kontoauszüge und Build-Artefakte hinzugefügt Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
1.3 KiB
PHP
Executable file
50 lines
1.3 KiB
PHP
Executable file
<?php
|
|
|
|
namespace Fhp\Protocol;
|
|
|
|
use Fhp\Segment\BaseSegment;
|
|
|
|
/**
|
|
* Collects segments and assigns them segment numbers in order to form a {@link Message}.
|
|
*/
|
|
class MessageBuilder
|
|
{
|
|
/**
|
|
* This is where the builder collects the (unencrypted/unwrapped) segments as they are being added.
|
|
* @var BaseSegment[]
|
|
*/
|
|
public $segments = [];
|
|
|
|
/** @return MessageBuilder A new instance. */
|
|
public static function create(): MessageBuilder
|
|
{
|
|
return new MessageBuilder();
|
|
}
|
|
|
|
/**
|
|
* @param BaseSegment|BaseSegment[] $segments The segment(s) to be added.
|
|
* @return $this The same instance for chaining.
|
|
*/
|
|
public function add($segments)
|
|
{
|
|
if (is_array($segments)) {
|
|
foreach ($segments as $segment) {
|
|
$this->addInternal($segment);
|
|
}
|
|
} else {
|
|
$this->addInternal($segments);
|
|
}
|
|
return $this;
|
|
}
|
|
|
|
private function addInternal(BaseSegment $segment)
|
|
{
|
|
if ($segment->segmentkopf === null) {
|
|
throw new \InvalidArgumentException(
|
|
'Segment lacks Segmentkopf, maybe you called ctor instead of createEmpty()');
|
|
}
|
|
$this->segments[] = $segment;
|
|
}
|
|
|
|
// Note: There is no single build() function, use Message::createWrappedMessage() instead.
|
|
}
|