<?php
namespace App\Worldspan\StructureParser\Structures\EMD;

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

		$passengers = new \App\Worldspan\StructureParser\Types\Passengers();

		$DE = $parsedStructure['EMD'][$transactionIndexes['EIdx']]['-E'];

		$item = new \App\Worldspan\StructureParser\Types\Passenger();

		$firstname = $DE['passengerName_']['firstname'];
		$lastname = $DE['passengerName_']['lastname'];

		$item->lastName = rtrim($lastname);
		$item->firstName = rtrim($firstname);
		$item->title = $DE['passengerName_']['title'];
		$item->type = $DE['passengerName_']['type'];

		$passengers->append($item);

		return $passengers;
	}
}
