| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Genkgo\Camt\Camt052\Decoder; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Genkgo\Camt\Decoder\Message as BaseMessageDecoder; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Genkgo\Camt\DTO; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Genkgo\Camt\Camt052\DTO as Camt052DTO; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use \SimpleXMLElement; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use \DateTimeImmutable; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Genkgo\Camt\Iban; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | abstract class Message extends BaseMessageDecoder | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |      * @param DTO\Message      $message | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |      * @param SimpleXMLElement $document | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 | 4 |  |     public function addRecords(DTO\Message $message, SimpleXMLElement $document) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 | 4 |  |         $reports = []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 | 4 |  |         $xmlReports = $this->getRootElement($document)->Rpt; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 | 4 |  |         foreach ($xmlReports as $xmlReport) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 | 4 |  |             $report = new Camt052DTO\Report( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 | 4 |  |                 (string) $xmlReport->Id, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 | 4 |  |                 new DateTimeImmutable((string)$xmlReport->CreDtTm), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 | 4 |  |                 $this->getAccount($xmlReport) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 | 4 |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 | 4 |  |             $this->recordDecoder->addBalances($report, $xmlReport); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 | 4 |  |             $this->recordDecoder->addEntries($report, $xmlReport); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 | 4 |  |             $reports[] = $report; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 | 4 |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 | 4 |  |         $message->setRecords($reports); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 | 4 |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      * @param SimpleXMLElement $xmlRecord | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |      * @return DTO\Account | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 43 |  |  |      */ | 
            
                                                        
            
                                    
            
            
                | 44 | 4 |  |     protected function getAccount(SimpleXMLElement $xmlRecord) | 
            
                                                        
            
                                    
            
            
                | 45 |  |  |     { | 
            
                                                        
            
                                    
            
            
                | 46 | 4 |  |         if (isset($xmlRecord->Acct->Id->IBAN)) { | 
            
                                                        
            
                                    
            
            
                | 47 | 3 |  |             return new DTO\IbanAccount(new Iban((string) $xmlRecord->Acct->Id->IBAN)); | 
            
                                                        
            
                                    
            
            
                | 48 |  |  |         } | 
            
                                                        
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 50 | 4 |  |         if (isset($xmlRecord->Acct->Id->BBAN)) { | 
            
                                                        
            
                                    
            
            
                | 51 |  |  |             return new DTO\BBANAccount((string) $xmlRecord->Acct->Id->BBAN); | 
            
                                                        
            
                                    
            
            
                | 52 | 1 |  |         } | 
            
                                                        
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 54 | 4 |  |         if (isset($xmlRecord->Acct->Id->UPIC)) { | 
            
                                                        
            
                                    
            
            
                | 55 |  |  |             return new DTO\UPICAccount((string) $xmlRecord->Acct->Id->UPIC); | 
            
                                                        
            
                                    
            
            
                | 56 |  |  |         } | 
            
                                                        
            
                                    
            
            
                | 57 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 58 | 4 |  |         if (isset($xmlRecord->Acct->Id->PrtryAcct)) { | 
            
                                                        
            
                                    
            
            
                | 59 | 4 |  |             return new DTO\ProprietaryAccount((string) $xmlRecord->Acct->Id->PrtryAcct->Id); | 
            
                                                        
            
                                    
            
            
                | 60 |  |  |         } | 
            
                                                        
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 62 | 3 |  |         if (isset($xmlRecord->Acct->Id->Othr)) { | 
            
                                                        
            
                                    
            
            
                | 63 | 3 |  |             $xmlOtherIdentification = $xmlRecord->Acct->Id->Othr; | 
            
                                                        
            
                                    
            
            
                | 64 | 3 |  |             $otherAccount = new DTO\OtherAccount((string) $xmlOtherIdentification->Id); | 
            
                                                        
            
                                    
            
            
                | 65 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 66 | 3 |  |             if (isset($xmlOtherIdentification->SchmeNm)) { | 
            
                                                        
            
                                    
            
            
                | 67 |  |  |                 if (isset($xmlOtherIdentification->SchmeNm->Cd)) { | 
            
                                                        
            
                                    
            
            
                | 68 |  |  |                     $otherAccount->setSchemeName((string) $xmlOtherIdentification->SchmeNm->Cd); | 
            
                                                        
            
                                    
            
            
                | 69 |  |  |                 } | 
            
                                                        
            
                                    
            
            
                | 70 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 71 |  |  |                 if (isset($otherIdentification->SchmeNm->Prtry)) { | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                        
            
                                    
            
            
                | 72 |  |  |                     $otherAccount->setSchemeName((string) $xmlOtherIdentification->SchmeNm->Prtry); | 
            
                                                        
            
                                    
            
            
                | 73 |  |  |                 } | 
            
                                                        
            
                                    
            
            
                | 74 | 3 |  |             } | 
            
                                                        
            
                                    
            
            
                | 75 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 76 | 3 |  |             if (isset($xmlOtherIdentification->Issr)) { | 
            
                                                        
            
                                    
            
            
                | 77 | 3 |  |                 $otherAccount->setIssuer($xmlOtherIdentification->Issr); | 
            
                                                        
            
                                    
            
            
                | 78 |  |  |             } | 
            
                                                        
            
                                    
            
            
                | 79 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 80 | 3 |  |             return $otherAccount; | 
            
                                                        
            
                                    
            
            
                | 81 |  |  |         } | 
            
                                                        
            
                                    
            
            
                | 82 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 83 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 84 |  |  |  | 
            
                        
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.