/**
  * Get the billing or shipping address information for the request
  *
  * @since 2.0.0
  * @param string $type address type, either `billing` or `shipping`
  * @return array address data
  */
 protected function get_address($type)
 {
     $billing_address = $this->order->billing_address_1 . (!empty($this->order->billing_address_2) ? ' ' . $this->order->billing_address_2 : '');
     $shipping_address = $this->order->shipping_address_1 . (!empty($this->order->shipping_address_2) ? ' ' . $this->order->shipping_address_2 : '');
     // address fields
     $fields = array('billing' => array('firstName' => array('value' => $this->order->billing_first_name, 'limit' => 50), 'lastName' => array('value' => $this->order->billing_last_name, 'limit' => 50), 'company' => array('value' => $this->order->billing_company, 'limit' => 50), 'address' => array('value' => $billing_address, 'limit' => 60), 'city' => array('value' => $this->order->billing_city, 'limit' => 40), 'state' => array('value' => $this->order->billing_state, 'limit' => 40), 'zip' => array('value' => $this->order->billing_postcode, 'limit' => 20), 'country' => array('value' => SV_WC_Helper::convert_country_code($this->order->billing_country), 'limit' => 60), 'phoneNumber' => array('value' => $this->order->billing_phone, 'limit' => 25)), 'shipping' => array('firstName' => array('value' => $this->order->shipping_first_name, 'limit' => 50), 'lastName' => array('value' => $this->order->shipping_last_name, 'limit' => 50), 'company' => array('value' => $this->order->shipping_company, 'limit' => 50), 'address' => array('value' => $shipping_address, 'limit' => 60), 'city' => array('value' => $this->order->shipping_city, 'limit' => 40), 'state' => array('value' => $this->order->shipping_state, 'limit' => 40), 'zip' => array('value' => $this->order->shipping_postcode, 'limit' => 20), 'country' => array('value' => SV_WC_Helper::convert_country_code($this->order->shipping_country), 'limit' => 60)));
     $address = array();
     foreach ($fields[$type] as $field_name => $field) {
         if ($value = $this->sanitize_address_field($field_name, $field)) {
             $address[$field_name] = $value;
         }
     }
     // handle empty shipping addresses by simply setting the address to the billing first/last name
     // this helps ensure each customer profile has a valid shipping address, even if it's not specifically used
     if ('shipping' === $type && empty($address)) {
         $address = array('firstName' => $this->sanitize_address_field('firstName', $fields['billing']['firstName']), 'lastName' => $this->sanitize_address_field('lastName', $fields['billing']['lastName']));
     }
     return $address;
 }