/** * @param DTO\Message $message * @param SimpleXMLElement $document */ public function addRecords(DTO\Message $message, SimpleXMLElement $document) { $notifications = []; $xmlNotifications = $this->getRootElement($document)->Ntfctn; foreach ($xmlNotifications as $xmlNotification) { $notification = new Camt054DTO\Notification((string) $xmlNotification->Id, new DateTimeImmutable((string) $xmlNotification->CreDtTm), $this->getAccount($xmlNotification)); if (isset($xmlNotification->NtfctnPgntn)) { $notification->setPagination(new DTO\Pagination((string) $xmlNotification->NtfctnPgntn->PgNb, 'true' === (string) $xmlNotification->NtfctnPgntn->LastPgInd ? true : false)); } if (isset($xmlNotification->AddtlNtfctnInf)) { $notification->setAdditionalInformation((string) $xmlNotification->AddtlNtfctnInf); } $this->addCommonRecordInformation($notification, $xmlNotification); $this->recordDecoder->addEntries($notification, $xmlNotification); $notifications[] = $notification; } $message->setRecords($notifications); }
/** * @param DTO\Message $message * @param SimpleXMLElement $document */ public function addRecords(DTO\Message $message, SimpleXMLElement $document) { $reports = []; $xmlReports = $this->getRootElement($document)->Rpt; foreach ($xmlReports as $xmlReport) { $report = new Camt052DTO\Report((string) $xmlReport->Id, new DateTimeImmutable((string) $xmlReport->CreDtTm), $this->getAccount($xmlReport)); if (isset($xmlReport->RptPgntn)) { $report->setPagination(new DTO\Pagination((string) $xmlReport->RptPgntn->PgNb, 'true' === (string) $xmlReport->RptPgntn->LastPgInd ? true : false)); } if (isset($xmlReport->AddtlRptInf)) { $report->setAdditionalInformation((string) $xmlReport->AddtlRptInf); } $this->addCommonRecordInformation($report, $xmlReport); $this->recordDecoder->addBalances($report, $xmlReport); $this->recordDecoder->addEntries($report, $xmlReport); $reports[] = $report; } $message->setRecords($reports); }