src/Amadeus/Client/Struct/Pnr/AddMultiElements/TravellerInfo.php
protected function addInfant($traveller)
    {
        $this->passengerData[0]->travellerInformation->traveller->quantity = 2;

        if ($traveller->withInfant && is_null($traveller->infant)) {
            $this->makePassengerIfNeeded();
            $this->passengerData[0]->travellerInformation->passenger[0]->infantIndicator = Passenger::INF_NOINFO;
        } elseif ($traveller->infant instanceof TravellerOptions) {
            if (empty($traveller->infant->lastName)) {
                $this->makePassengerIfNeeded();
                $this->passengerData[0]->travellerInformation->passenger[0]->infantIndicator = Passenger::INF_GIVEN;

                $tmpInfantPassenger = new Passenger(
                    $traveller->infant->firstName,
                    Passenger::PASST_INFANT
                );

                $this->passengerData[0]->travellerInformation->passenger[] = $tmpInfantPassenger;
            } else {
                $this->makePassengerIfNeeded();
                $this->passengerData[0]->travellerInformation->passenger[0]->infantIndicator = Passenger::INF_FULL;

                $tmpInfant = new PassengerData($traveller->infant->lastName);
                $tmpInfant->travellerInformation->passenger[] = new Passenger(
                    $traveller->infant->firstName,
                    Passenger::PASST_INFANT
                );

                if ($traveller->infant->dateOfBirth instanceof \DateTime) {
                    $tmpInfant->dateOfBirth = new DateOfBirth(
                        $this->formatDateOfBirth($traveller->infant->dateOfBirth)
                    );
                }

                $this->passengerData[] = $tmpInfant;
            }
        }
    }
protected function addInfant($traveller)
    {
        $this->passengerData[0]->travellerInformation->traveller->quantity = 2;

        if ($traveller->withInfant && is_null($traveller->infant)) {
            $this->makePassengerIfNeeded();
            $this->passengerData[0]->travellerInformation->passenger[0]->infantIndicator = Passenger::INF_NOINFO;
        } elseif ($traveller->infant instanceof TravellerOptions) {
            if (empty($traveller->infant->lastName)) {
                $this->makePassengerIfNeeded();
                $this->passengerData[0]->travellerInformation->passenger[0]->infantIndicator = Passenger::INF_GIVEN;

                $tmpInfantPassenger = new Passenger(
                    $traveller->infant->firstName,
                    Passenger::PASST_INFANT
                );

                $this->passengerData[0]->travellerInformation->passenger[] = $tmpInfantPassenger;
            } else {
                $this->makePassengerIfNeeded();
                $this->passengerData[0]->travellerInformation->passenger[0]->infantIndicator = Passenger::INF_FULL;

                $tmpInfant = new PassengerData($traveller->infant->lastName);
                $tmpInfant->travellerInformation->passenger[] = new Passenger(
                    $traveller->infant->firstName,
                    Passenger::PASST_INFANT
                );

                if ($traveller->infant->dateOfBirth instanceof \DateTime) {
                    $tmpInfant->dateOfBirth = new DateOfBirth(
                        $this->formatDateOfBirth($traveller->infant->dateOfBirth)
                    );
                }

                $this->passengerData[] = $tmpInfant;
            }
        }
    }
protected function addInfant ( $ traveller ) { $ this -> passengerData [ 0 ] -> travellerInformation -> traveller -> quantity = 2 ; if ( $ traveller -> withInfant && is_null ( $ traveller -> infant ) ) { $ this -> makePassengerIfNeeded ( ) ; $ this -> passengerData [ 0 ] -> travellerInformation -> passenger [ 0 ] -> infantIndicator = Passenger :: INF_NOINFO ; } elseif ( $ traveller -> infant instanceof TravellerOptions ) { if ( empty ( $ traveller -> infant -> lastName ) ) { $ this -> makePassengerIfNeeded ( ) ; $ this -> passengerData [ 0 ] -> travellerInformation -> passenger [ 0 ] -> infantIndicator = Passenger :: INF_GIVEN ; $ tmpInfantPassenger = new Passenger ( $ traveller -> infant -> firstName , Passenger :: PASST_INFANT ) ; $ this -> passengerData [ 0 ] -> travellerInformation -> passenger [ ] = $ tmpInfantPassenger ; } else { $ this -> makePassengerIfNeeded ( ) ; $ this -> passengerData [ 0 ] -> travellerInformation -> passenger [ 0 ] -> infantIndicator = Passenger :: INF_FULL ; $ tmpInfant = new PassengerData ( $ traveller -> infant -> lastName ) ; $ tmpInfant -> travellerInformation -> passenger [ ] = new Passenger ( $ traveller -> infant -> firstName , Passenger :: PASST_INFANT ) ; if ( $ traveller -> infant -> dateOfBirth instanceof \ DateTime ) { $ tmpInfant -> dateOfBirth = new DateOfBirth ( $ this -> formatDateOfBirth ( $ traveller -> infant -> dateOfBirth ) ) ; } $ this -> passengerData [ ] = $ tmpInfant ; } } }
Add infant

3 scenario's:
- infant without additional information
- infant with only first name provided
- infant with first name, last name & date of birth provided.

@param TravellerOptions $traveller
Add infant