public function toArray(AddressInterface $address)
    {
        $cityLocationId = $address->getCity();
        $cityHierarchy = $this
            ->locationProvider
            ->getHierarchy($cityLocationId);
        $cityHierarchyAsc = array_reverse($cityHierarchy);

        $addressArray = [
            'id' => $address->getId(),
            'name' => $address->getName(),
            'recipientName' => $address->getRecipientName(),
            'recipientSurname' => $address->getRecipientSurname(),
            'address' => $address->getAddress(),
            'addressMore' => $address->getAddressMore(),
            'postalCode' => $address->getPostalcode(),
            'phone' => $address->getPhone(),
            'mobile' => $address->getMobile(),
            'comment' => $address->getComments(),
        ];

        foreach ($cityHierarchyAsc as $cityLocationNode) {
            /**
             * @var LocationData $cityLocationNode
             */
            $addressArray['city'][$cityLocationNode->getType()]
                = $cityLocationNode->getName();
        }

        $addressArray['fullAddress'] =
            $this->buildFullAddressString(
                $address,
                $addressArray['city']
            );

        return $addressArray;
    }
public function toArray(AddressInterface $address)
    {
        $cityLocationId = $address->getCity();
        $cityHierarchy = $this
            ->locationProvider
            ->getHierarchy($cityLocationId);
        $cityHierarchyAsc = array_reverse($cityHierarchy);

        $addressArray = [
            'id' => $address->getId(),
            'name' => $address->getName(),
            'recipientName' => $address->getRecipientName(),
            'recipientSurname' => $address->getRecipientSurname(),
            'address' => $address->getAddress(),
            'addressMore' => $address->getAddressMore(),
            'postalCode' => $address->getPostalcode(),
            'phone' => $address->getPhone(),
            'mobile' => $address->getMobile(),
            'comment' => $address->getComments(),
        ];

        foreach ($cityHierarchyAsc as $cityLocationNode) {
            /**
             * @var LocationData $cityLocationNode
             */
            $addressArray['city'][$cityLocationNode->getType()]
                = $cityLocationNode->getName();
        }

        $addressArray['fullAddress'] =
            $this->buildFullAddressString(
                $address,
                $addressArray['city']
            );

        return $addressArray;
    }
public function toArray ( AddressInterface $ address ) { $ cityLocationId = $ address -> getCity ( ) ; $ cityHierarchy = $ this -> locationProvider -> getHierarchy ( $ cityLocationId ) ; $ cityHierarchyAsc = array_reverse ( $ cityHierarchy ) ; $ addressArray = [ 'id' => $ address -> getId ( ) , 'name' => $ address -> getName ( ) , 'recipientName' => $ address -> getRecipientName ( ) , 'recipientSurname' => $ address -> getRecipientSurname ( ) , 'address' => $ address -> getAddress ( ) , 'addressMore' => $ address -> getAddressMore ( ) , 'postalCode' => $ address -> getPostalcode ( ) , 'phone' => $ address -> getPhone ( ) , 'mobile' => $ address -> getMobile ( ) , 'comment' => $ address -> getComments ( ) , ] ; foreach ( $ cityHierarchyAsc as $ cityLocationNode ) { /**
             * @var LocationData $cityLocationNode
             */ $ addressArray [ 'city' ] [ $ cityLocationNode -> getType ( ) ] = $ cityLocationNode -> getName ( ) ; } $ addressArray [ 'fullAddress' ] = $ this -> buildFullAddressString ( $ address , $ addressArray [ 'city' ] ) ; return $ addressArray ; }
Formats an address on an array.

@param AddressInterface $address The address to format

@return array
Formats an address on an array .