Returns an array of filtered addresses
@param array $addresses
@param array $data
@return array
356619
protected function prepareList(array $addresses, array $data)
    {
        $countries = $this->country->getList();

        $list = array();
        foreach ($addresses as $address_id => $address) {

            $list[$address_id] = $address;

            if (empty($data['status'])) {
                continue; // Do not check enabled country, state and city
            }

            if (empty($countries)) {
                continue; // No countries defined in the system
            }

            if ($address['country'] !== '' && $address['country_status'] == 0) {
                unset($list[$address_id]);
                continue;
            }

            if (!empty($address['state_id']) && $address['state_status'] == 0) {
                unset($list[$address_id]);
                continue;
            }

            // City ID can also be not numeric (user input)
            if (is_numeric($address['city_id']) && $address['city_status'] == 0) {
                unset($list[$address_id]);
            }
        }

        return $list;
    }
591037
protected function getAddresses() {
        if (!$this->_addresses) {
            $this->_addresses = new AddressList($this->version, $this->solution['sid']);
        }

        return $this->_addresses;
    }
1280050
public function cleanCustomerAddress(array $address) {
    if (isset($address['customer_address_id']) && empty($address['address_id'])) {
      $address['address_id'] = $address['customer_address_id'];
    }

    return $this->cleanAddress($address);
  }
319560
public function getAddresses($postcode = null, $number = null, $from = 0)
    {
        return $this->get('/addresses/', [
            'postcode' => $postcode,
            'number' => $number,
            'from' => $from
        ]);
    }
954525
def get_addresses(self, fetch=False):
        """"""
        return Addresses(self.resource.addresses, self.client, populate=fetch)
721071
public static function filter_input(array $data, array $filters)
    {
        $gump = self::get_instance();

        return $gump->filter($data, $filters);
    }
829886
public function unredislizeArray(array $data)
    {
        $result = [];
        foreach ($data as $key => $value) {
            $result[$key] = $this->unredislize($value);
        }

        return $result;
    }
388367
protected function byAssociations(array $data): array
    {
        $result = [];
        foreach ($this->getAssociationsBySearchData($data) as $association) {
            // skip non-supported associations
            if (!in_array($association->type(), Options::getSearchableAssociations())) {
                continue;
            }

            $targetTable = $association->getTarget();

            // skip associations with itself
            if ($targetTable->getTable() === $this->table->getTable()) {
                continue;
            }

            $primaryKeys = [];
            foreach ((array)$targetTable->getPrimaryKey() as $primaryKey) {
                $primaryKeys[] = $targetTable->aliasField($primaryKey);
            }

            // instantiate Search on related table
            $search = new Search($targetTable, $this->user);

            $select = array_diff($search->getSelectClause($data), $primaryKeys);
            if (!empty($select)) {
                $result[$association->getName()]['select'] = $select;
            }

            $where = $search->getWhereClause($data);
            if (!empty($where)) {
                $result[$association->getName()]['where'] = $where;
            }
        }

        return $result;
    }
1336779
private function buildMagentoAddressArray($order, $address)
    {
        $phoneNumber = $order->getMobile() ? : $order->getPhone();
        $region      = $this->regionsHelper->getMageRegionByAddress($address);
        $street2     = $address->getStreet2() ? "\n" . $address->getStreet2() : '';

        return [
            'company'    => $address->getCompany(),
            'firstname'  => $address->getFirstName(),
            'lastname'   => $address->getLastName(),
            'street'     => $address->getStreet1() . $street2,
            'city'       => $address->getCity(),
            'postcode'   => $address->getZipcode(),
            'telephone'  => $phoneNumber ? : 'n.a.',
            'email'      => $order->getMail(),
            'country_id' => $address->getCountry(),
            'region_id'  => $region->getId() ? : ''
        ];
    }
301434
public static function fromAddressesArray($addresses)
    {
        ArgumentArrayValidator::validate($addresses, 'addresses');
        $addressList = new self();
        $addressList->setAddresses($addresses);
        return $addressList;
    }
1323642
public function addressToCoordinates(array $addressData = [])
	{
		$this->returnLocationData = array_merge($this->returnLocationData, array_only($addressData, ['country', 'region', 'city', 'street', 'street_number']));
		return $this;
	}
673918
public function getDtrustTransactionsByAddresses(
        $type, $addresses, $beforeTx = null
    ) {
        if (is_null($beforeTx)) {
            $array = [
                'type'      => $type,
                'addresses' => $addresses,
            ];
        } else {
            $array = [
                'type'      => $type,
                'addresses' => $addresses,
                'before_tx' => $beforeTx,
            ];
        }

        return $this->blockIo->get_dtrust_transactions($array);
    }
775108
public function getAddresses(float $latitude, float $longitude): ?array
    {
        // init results
        $addresses = [];

        // define result
        $addressSuggestions = $this->doCall(array(
            'latlng' => $latitude . ',' . $longitude,
            'sensor' => 'false'
        ));

        // loop addresses
        foreach ($addressSuggestions as $key => $addressSuggestion) {
            $addresses[$key] = Address::createFromGoogleResult($addressSuggestion);
        }

        return $addresses;
    }
480469
public function deleteEmailAddress(array $addresses = []): bool
    {
        $this->getApi()->request($this->getApi()->sprintf('/user/emails'), Request::METHOD_DELETE, $addresses);

        if ($this->getApi()->getHeaders()['Status'] == '204 No Content') {
            return true;
        }

        return false;
    }
880518
private function decodeEmailAddresses(array $addresses): array
    {
        $return = [];
        foreach ($addresses as $address) {
            if (isset($address->mailbox)) {
                $return[] = $this->decodeEmailAddress($address);
            }
        }

        return $return;
    }
785753
public function getCoordinatesForAddress($street = null, $zip = null, $city = null, $country = ''): array
    {
        $addressParts = [];
        foreach ([$street, $zip . ' ' . $city, $country] as $addressPart) {
            if (empty($addressPart)) {
                continue;
            }
            $addressParts[] = trim($addressPart);
        }
        $address = ltrim(implode(',', $addressParts), ',');
        if (empty($address)) {
            return [];
        }
        $cacheObject = $this->initializeCache();
        $cacheKey = 'geocode-' . strtolower(str_replace(' ', '-', preg_replace('/[^0-9a-zA-Z ]/m', '', $address)));
        // Found in cache? Return it.
        if ($cacheObject->has($cacheKey)) {
            return $cacheObject->get($cacheKey);
        }
        $result = $this->getApiCallResult(
            $this->geocodingUrl . '&address=' . urlencode($address)
        );
        if (empty($result) || empty($result['results']) || empty($result['results'][0]['geometry'])) {
            return [];
        }
        $geometry = $result['results'][0]['geometry'];
        $result = [
            'latitude' => $geometry['location']['lat'],
            'longitude' => $geometry['location']['lng'],
        ];
        // Now store the $result in cache and return
        $cacheObject->set($cacheKey, $result, [], $this->cacheTime);
        return $result;
    }
276997
public function update(array $data, array $headers = [])
    {
        $url = $this->url('addresses');

        return $this->post($url, $data, $headers);
    }