<?php
namespace App\Sabre\StructureParser\Structures\Hotel; class Documents extends \App\Sabre\StructureParser\Structures\Base\Documents { protected function _getData() { list(, , $transactionIndexes, ) = $this->getTransactionDetails(); if (in_array($transactionIndexes['source'], ['M3Hhl', 'M3Oths:HHL, M5->M3, M5->M1', 'M3Oths:HHL, M5->M3', ])) { return $this->_getData_M3Hhl(); } elseif (in_array($transactionIndexes['source'], ['M3Oths:HHT', 'M3Oths:HHT, M5->M3', 'M3Oths:HHT, M5->M3, M5->M1',])) { return $this->_getData_M3Oths_HHL(); } elseif (in_array($transactionIndexes['source'], ['M3Oths:HHX', 'M3Oths:HHX, M5->M3', 'M3Oths:HHX, M5->M3, M5->M1', ])) { return $this->_getData_M3Oths_HHX(); } else { throw new \Exception(sprintf("Don't know how to interpret source '%s'", $transactionIndexes['source'])); } } private function _getData_M3Hhl() { list($parsedStructure, $transactionType, $transactionIndexes, $internalAssociations) = $this->getTransactionDetails(); $item = new \App\Sabre\StructureParser\Types\Document(); $M3 = $parsedStructure['M3'][$transactionIndexes['km3']]; $item->docNumber = $M3['M3Hhl']['_confirmationNumber']; $item->docDate = $parsedStructure['M0']['M0']['IU0PDT']; $item = $this->populate($item, $parsedStructure, $transactionType, $transactionIndexes, $internalAssociations); return $item; } private function _getData_M3Oths_HHL() { list($parsedStructure, $transactionType, $transactionIndexes, $internalAssociations) = $this->getTransactionDetails(); $item = new \App\Sabre\StructureParser\Types\Document(); $M3 = $parsedStructure['M3'][$transactionIndexes['km3']]; $item->docNumber = $M3['M3Oths']['IU3VR4_']['CF']; $item->docDate = $parsedStructure['M0']['M0']['IU0PDT']; $item = $this->populate($item, $parsedStructure, $transactionType, $transactionIndexes, $internalAssociations); return $item; } private function _getData_M3Oths_HHX() { list($parsedStructure, $transactionType, $transactionIndexes, $internalAssociations) = $this->getTransactionDetails(); $item = new \App\Sabre\StructureParser\Types\Document(); $M3 = $parsedStructure['M3'][$transactionIndexes['km3']]; $item->docNumber = $M3['M3Oths']['IU3VR4_']['CF']; $item->docDate = $parsedStructure['M0']['M0']['IU0PDT']; $item = $this->populate($item, $parsedStructure, $transactionType, $transactionIndexes, $internalAssociations); return $item; } } 