src/Sulu/Bundle/Sales/CoreBundle/Manager/OrderAddressManager.php
public function getContactData($addressData, Contact $contact = null)
    {
        $result = array();
        // if account is set, take account's name
        if ($addressData && isset($addressData['firstName']) && isset($addressData['lastName'])) {
            $result['firstName'] = $addressData['firstName'];
            $result['lastName'] = $addressData['lastName'];
            $result['fullName'] = $result['firstName'] . ' ' . $result['lastName'];
            if (isset($addressData['title'])) {
                $result['title'] = $addressData['title'];
            }
            if (isset($addressData['salutation'])) {
                $result['salutation'] = $addressData['salutation'];
            }
        } elseif ($contact) {
            $result['firstName'] = $contact->getFirstName();
            $result['lastName'] = $contact->getLastName();
            $result['fullName'] = $contact->getFullName();
            $result['salutation'] = $contact->getFormOfAddress();
            if ($contact->getTitle() !== null) {
                $result['title'] = $contact->getTitle()->getTitle();
            }
        } else {
            throw new MissingAttributeException('firstName, lastName or contact');
        }

        return $result;
    }
public function getContactData($addressData, Contact $contact = null)
    {
        $result = array();
        // if account is set, take account's name
        if ($addressData && isset($addressData['firstName']) && isset($addressData['lastName'])) {
            $result['firstName'] = $addressData['firstName'];
            $result['lastName'] = $addressData['lastName'];
            $result['fullName'] = $result['firstName'] . ' ' . $result['lastName'];
            if (isset($addressData['title'])) {
                $result['title'] = $addressData['title'];
            }
            if (isset($addressData['salutation'])) {
                $result['salutation'] = $addressData['salutation'];
            }
        } elseif ($contact) {
            $result['firstName'] = $contact->getFirstName();
            $result['lastName'] = $contact->getLastName();
            $result['fullName'] = $contact->getFullName();
            $result['salutation'] = $contact->getFormOfAddress();
            if ($contact->getTitle() !== null) {
                $result['title'] = $contact->getTitle()->getTitle();
            }
        } else {
            throw new MissingAttributeException('firstName, lastName or contact');
        }

        return $result;
    }
public function getContactData ( $ addressData , Contact $ contact = null ) { $ result = array ( ) ; // if account is set, take account's name if ( $ addressData && isset ( $ addressData [ 'firstName' ] ) && isset ( $ addressData [ 'lastName' ] ) ) { $ result [ 'firstName' ] = $ addressData [ 'firstName' ] ; $ result [ 'lastName' ] = $ addressData [ 'lastName' ] ; $ result [ 'fullName' ] = $ result [ 'firstName' ] . ' ' . $ result [ 'lastName' ] ; if ( isset ( $ addressData [ 'title' ] ) ) { $ result [ 'title' ] = $ addressData [ 'title' ] ; } if ( isset ( $ addressData [ 'salutation' ] ) ) { $ result [ 'salutation' ] = $ addressData [ 'salutation' ] ; } } elseif ( $ contact ) { $ result [ 'firstName' ] = $ contact -> getFirstName ( ) ; $ result [ 'lastName' ] = $ contact -> getLastName ( ) ; $ result [ 'fullName' ] = $ contact -> getFullName ( ) ; $ result [ 'salutation' ] = $ contact -> getFormOfAddress ( ) ; if ( $ contact -> getTitle ( ) !== null ) { $ result [ 'title' ] = $ contact -> getTitle ( ) -> getTitle ( ) ; } } else { throw new MissingAttributeException ( 'firstName, lastName or contact' ) ; } return $ result ; }
Returns contact data as an array. either by provided address or contact

@param array $addressData
@param Contact $contact

@throws MissingAttributeException

@return array
Returns contact data as an array . either by provided address or contact