Get possible addresses using CoordinatesInterface

@param CoordinatesInterface $coordinates
@return AddressCollection
170307
public function getAddresses(CoordinatesInterface $coordinates) : AddressCollection
    {
        $url = $this->coordinatesQuery($coordinates);
        $json = $this->fetchUrl($url);

        // convert google data to address collection
        $results = [];
        foreach ($json->results as $result) {
            $address = AddressBuild::create($result);
            $address->setCoordinates($coordinates);
            $results[] = $address;
        }

        return new AddressCollection($results);
    }
844728
protected function arrayToAddress($addresses) {
        $addressesAsString = array();
        foreach ($addresses as $address) {
            $addressesAsString[] = $this->toAddress($address);
        }
        return $addressesAsString;
    }
1080539
private function formatOutputLocationArray($locations)
    {
        $formattedResponse = [];

        /**
         * @var LocationInterface $location
         */
        foreach ($locations as $location) {
            $formattedResponse[] = $this->formatOutputLocation($location);
        }

        return $formattedResponse;
    }
996560
public function getNearestStreetPoint(Coordinate $coordinate) {
        $this->prepareServerUrl();
        
        $requestUrl = $this->server . 'nearest?' . $coordinate;
        $curl = curl_init();
        curl_setopt_array($curl, array(
           CURLOPT_RETURNTRANSFER => 1,
           CURLOPT_URL => $requestUrl,
        ));
        
        $resp = curl_exec($curl);
        
        curl_close($curl);
        $json = json_decode($resp);
        
        if($json->status === 0) {
            $latitude = $json->mapped_coordinate[0];
            $longitude = $json->mapped_coordinate[1];
            $name = $json->name;
            
            $retCoord = new Coordinate($latitude, $longitude);
            $retCoord->setName($name);
            
            return $retCoord;
        } else {
            throw new OsrmException("Osrm status error", $json->{'status'});
            return null;
        }
    }
591037
protected function getAddresses() {
        if (!$this->_addresses) {
            $this->_addresses = new AddressList($this->version, $this->solution['sid']);
        }

        return $this->_addresses;
    }
1057087
public function getAddress($index)
    {
        if (!isset($this->addresses[$index])) {
            return null;
        }
        return $this->addresses[$index];
    }
203275
protected function extractAddressValues(AddressInterface $address)
    {
        $values = [];
        foreach (AddressField::getAll() as $field) {
            $getter = 'get' . ucfirst($field);
            $values[$field] = $address->$getter();
        }

        return $values;
    }
1323642
public function addressToCoordinates(array $addressData = [])
	{
		$this->returnLocationData = array_merge($this->returnLocationData, array_only($addressData, ['country', 'region', 'city', 'street', 'street_number']));
		return $this;
	}
954525
def get_addresses(self, fetch=False):
        """"""
        return Addresses(self.resource.addresses, self.client, populate=fetch)
630026
private function adaptAddresses(array $addresses): array
    {
        $adapted = [];
        foreach ($addresses as $address) {
            if ($address->name() !== null) {
                $adapted[$address->email()] = $address->name();
            } else {
                $adapted[] = $address->email();
            }
        }

        return $adapted;
    }
860674
public function getAddressRaw($address, \DateTime $from = null)
    {
        $result = false;

        $response = $this->request(sprintf('/api/address/%s/raw', $address));

        if ($response !== false && is_array($response)) {
            $result = [];
            foreach ($response as $data) {
                $transaction = new Transaction($data);

                if ($transaction->getOutAmount($address) !== false) {
                    if ($from === null || $transaction->getTime() > $from) {
                        $result[] = $transaction;
                    }
                }
            }
        }

        return $result;
    }
519131
private function getBox(array $coordinates)
    {
        $height = abs($coordinates['y1'] - $coordinates['y2']);
        $width = abs($coordinates['x1'] - $coordinates['x2']);

        return new Box($width, $height);
    }
571725
public function getAddresses()
    {
        $addresses = [];
        $groups    = $this->rpc->query("listAddressGroupings");
        foreach($groups as $group) {
            foreach($group as $info) {
                $addresses[] = $info[0];
            }
        }

        return $addresses;
    }
303687
public function setCoordinate(Coordinate $coordinate)
    {
        $this->sortsBy = array_map(function (array $sortBy) use ($coordinate) {
            if (self::TYPE_DISTANCE === $sortBy['type']) {
                $sortBy['coordinate'] = $coordinate;
            }

            return $sortBy;
        }, $this->sortsBy);

        return $this;
    }
1325424
private function coordinatesQuery(CoordinatesInterface $coordinates) : string
    {
        $url = sprintf(self::API_COORDINATES_URL_SSL, $coordinates->getLatitude(), $coordinates->getLongitude());
        $url = $this->buildQuery($url, $this->apiKey, $this->locale, $this->region);

        return $url;
    }
596533
private function getLocations($locations)
    {
        $array=[];
        foreach ($locations as $location) { /* @var \Core\Entity\LocationInterface $location */
            array_push(
                $array,
                [
                    '@type' => 'Place',
                    'address' => [
                        '@type' => 'PostalAddress',
                        'streetAddress' => $location->getStreetname() .' '.$location->getStreetnumber(),
                        'postalCode' => $location->getPostalCode(),
                        'addressLocality' => $location->getCity(),
                        'addressCountry' => $location->getCountry(),
                        'addressRegion' => $location->getRegion(),
                    ]
                ]
            );
        }
        return $array;
    }
1164454
protected static function getAddress(ParametersInterface $parameters)
    {
        if (filter_var($host = $parameters->host, FILTER_VALIDATE_IP)) {
            return $host;
        }

        if ($host === $address = gethostbyname($host)) {
            return false;
        }

        return $address;
    }