modules/acm_checkout/src/Plugin/CheckoutPane/StoredAddressTrait.php
public static function findAddress($address_id) {
    $found_address = NULL;
    $user = \Drupal::service('acm.commerce_user_manager')->getAccount();
    $addresses = $user->getAddresses();

    $extra_keys = [
      'customer_id',
      'customer_address_id',
      'region_id',
      'default_billing',
      'default_shipping',
      'extension',
    ];

    foreach ($addresses as $address) {
      if ($address['address_id'] != $address_id) {
        continue;
      }

      // Found address, strip out extra info.
      foreach ($extra_keys as $key) {
        unset($address[$key]);
      }

      $found_address = $address;
      break;
    }

    return $found_address;
  }
public static function findAddress($address_id) {
    $found_address = NULL;
    $user = \Drupal::service('acm.commerce_user_manager')->getAccount();
    $addresses = $user->getAddresses();

    $extra_keys = [
      'customer_id',
      'customer_address_id',
      'region_id',
      'default_billing',
      'default_shipping',
      'extension',
    ];

    foreach ($addresses as $address) {
      if ($address['address_id'] != $address_id) {
        continue;
      }

      // Found address, strip out extra info.
      foreach ($extra_keys as $key) {
        unset($address[$key]);
      }

      $found_address = $address;
      break;
    }

    return $found_address;
  }
public static function findAddress ( $ address_id ) { $ found_address = NULL ; $ user = \ Drupal :: service ( 'acm.commerce_user_manager' ) -> getAccount ( ) ; $ addresses = $ user -> getAddresses ( ) ; $ extra_keys = [ 'customer_id' , 'customer_address_id' , 'region_id' , 'default_billing' , 'default_shipping' , 'extension' , ] ; foreach ( $ addresses as $ address ) { if ( $ address [ 'address_id' ] != $ address_id ) { continue ; } // Found address, strip out extra info. foreach ( $ extra_keys as $ key ) { unset ( $ address [ $ key ] ) ; } $ found_address = $ address ; break ; } return $ found_address ; }
Finds an address by id.

@param string|int $address_id
The address id.

@return null|array
The found address.
Finds an address by id .