public function calculateDistance($locationA, $locationB, $metric = false) : int
    {
        $locationA = is_array($locationA) ? implode(',', $locationA) : $locationA;
        $locationB = is_array($locationB) ? implode(',', $locationB) : $locationB;

        if ($locationA == $locationB) {
            return 0;
        }

        $response = file_get_contents('https://maps.googleapis.com/maps/api/distancematrix/json?origins=' . urlencode($locationA) . '&destinations=' . urlencode($locationB) . '&key=' . $this->apiKey);
        $data     = json_decode($response);

        if ($data->rows[0]->elements[0]->status == 'NOT_FOUND') {
            throw new \Exception('GoogleMaps exception: ADDRESS NOT FOUND. [' . $locationA . ' | ' . $locationB . ']', 1);
        }
        if ($data->rows[0]->elements[0]->status == 'ZERO_RESULTS') {
            return 9999999;
        }

        $distance = $data->rows[0]->elements[0]->distance->value;

        return $metric ? $distance : $distance * self::KM_TO_MILE;
    }