protected function getPlaces(ContactSource $contactSource)
    {
        // Get Places from IP addresses
        $places = [];
        if ($contactSource->getIpAddresses()) {
            foreach ($contactSource->getIpAddresses() as $ip) {
                if ($details = $ip->getIpDetails()) {
                    if (!empty($details['latitude']) && !empty($details['longitude'])) {
                        $name = 'N/A';
                        if (!empty($details['city'])) {
                            $name = $details['city'];
                        } elseif (!empty($details['region'])) {
                            $name = $details['region'];
                        }
                        $place    = [
                            'latLng' => [$details['latitude'], $details['longitude']],
                            'name'   => $name,
                        ];
                        $places[] = $place;
                    }
                }
            }
        }

        return $places;
    }
protected function getPlaces(ContactSource $contactSource)
    {
        // Get Places from IP addresses
        $places = [];
        if ($contactSource->getIpAddresses()) {
            foreach ($contactSource->getIpAddresses() as $ip) {
                if ($details = $ip->getIpDetails()) {
                    if (!empty($details['latitude']) && !empty($details['longitude'])) {
                        $name = 'N/A';
                        if (!empty($details['city'])) {
                            $name = $details['city'];
                        } elseif (!empty($details['region'])) {
                            $name = $details['region'];
                        }
                        $place    = [
                            'latLng' => [$details['latitude'], $details['longitude']],
                            'name'   => $name,
                        ];
                        $places[] = $place;
                    }
                }
            }
        }

        return $places;
    }
protected function getPlaces ( ContactSource $ contactSource ) { // Get Places from IP addresses $ places = [ ] ; if ( $ contactSource -> getIpAddresses ( ) ) { foreach ( $ contactSource -> getIpAddresses ( ) as $ ip ) { if ( $ details = $ ip -> getIpDetails ( ) ) { if ( ! empty ( $ details [ 'latitude' ] ) && ! empty ( $ details [ 'longitude' ] ) ) { $ name = 'N/A' ; if ( ! empty ( $ details [ 'city' ] ) ) { $ name = $ details [ 'city' ] ; } elseif ( ! empty ( $ details [ 'region' ] ) ) { $ name = $ details [ 'region' ] ; } $ place = [ 'latLng' => [ $ details [ 'latitude' ] , $ details [ 'longitude' ] ] , 'name' => $ name , ] ; $ places [ ] = $ place ; } } } } return $ places ; }
Get a list of places for the contactSource based on IP location.

@param ContactSource $contactSource

@return array
Get a list of places for the contactSource based on IP location .