<?php
namespace App\Sabre\StructureParser\Structures\DocumentIssue;

class Supplier extends \App\Sabre\StructureParser\Structures\Base\Supplier
{
	protected function _getData()
	{
		list($parsedStructure, , $transactionIndexes, ) = $this->getTransactionDetails();

		$item = new \App\Sabre\StructureParser\Types\Supplier();

		$M5 = $parsedStructure['M5'][$transactionIndexes['km5']];

		if ($M5['vendorCode']) {
			$item->name = $M5['vendorCode'];
		}
		else {
			$item->codeAirline = $M5['validatingCarrierCode'];
		}

		return $item;
	}
}
