private function updateResponseWithResults($json)
	{
		$response = $this->jsonToArray($json);

		if(isset($response['results'][0])) {
			$this->response = $response['results'][0];

			if(@$response['results'][0]['partial_match'] && $this->excludePartials) {
				throw new Exception(trans('location::errors.no_results'));
			}

			if(! $this->returnLocationData['country']) {
				$this->returnLocationData['country'] = $this->findInGoogleSet($response, ['country']);
				$this->returnLocationData['iso'] = $this->findInGoogleSet($response, ['country'], 'short_name');
			}

			if(! $this->returnLocationData['region']) {
				$this->returnLocationData['region'] = $this->findInGoogleSet($response, ['administrative_area_level_1']);
			}

			if(! $this->returnLocationData['city']) {
				$this->returnLocationData['city'] = $this->findInGoogleSet($response, ['administrative_area_level_2']);
			}

			if(! $this->returnLocationData['street']) {
				$this->returnLocationData['street'] = $this->findInGoogleSet($response, ['route']);
			}

			if(! $this->returnLocationData['street_number']) {
				$this->returnLocationData['street_number'] = $this->findInGoogleSet($response, ['street_number']);
			}

			if(! $this->returnLocationData['postal_code']) {
				$this->returnLocationData['postal_code'] = $this->findInGoogleSet($response, ['postal_code']);
			}

			if(! $this->returnLocationData['latitude']) {
				$this->returnLocationData['latitude'] = $response['results'][0]['geometry']['location']['lat'];
			}

			if(! $this->returnLocationData['longitude']) {
				$this->returnLocationData['longitude'] = $response['results'][0]['geometry']['location']['lng'];
			}
		}
        elseif(@$response['location']) {
            $this->returnLocationData['latitude'] = $response['location']['lat'];
            $this->returnLocationData['longitude'] = $response['location']['lng'];
        }
		else {
			throw new Exception(trans('location::errors.no_results'));
		}
	}
private function updateResponseWithResults($json)
	{
		$response = $this->jsonToArray($json);

		if(isset($response['results'][0])) {
			$this->response = $response['results'][0];

			if(@$response['results'][0]['partial_match'] && $this->excludePartials) {
				throw new Exception(trans('location::errors.no_results'));
			}

			if(! $this->returnLocationData['country']) {
				$this->returnLocationData['country'] = $this->findInGoogleSet($response, ['country']);
				$this->returnLocationData['iso'] = $this->findInGoogleSet($response, ['country'], 'short_name');
			}

			if(! $this->returnLocationData['region']) {
				$this->returnLocationData['region'] = $this->findInGoogleSet($response, ['administrative_area_level_1']);
			}

			if(! $this->returnLocationData['city']) {
				$this->returnLocationData['city'] = $this->findInGoogleSet($response, ['administrative_area_level_2']);
			}

			if(! $this->returnLocationData['street']) {
				$this->returnLocationData['street'] = $this->findInGoogleSet($response, ['route']);
			}

			if(! $this->returnLocationData['street_number']) {
				$this->returnLocationData['street_number'] = $this->findInGoogleSet($response, ['street_number']);
			}

			if(! $this->returnLocationData['postal_code']) {
				$this->returnLocationData['postal_code'] = $this->findInGoogleSet($response, ['postal_code']);
			}

			if(! $this->returnLocationData['latitude']) {
				$this->returnLocationData['latitude'] = $response['results'][0]['geometry']['location']['lat'];
			}

			if(! $this->returnLocationData['longitude']) {
				$this->returnLocationData['longitude'] = $response['results'][0]['geometry']['location']['lng'];
			}
		}
        elseif(@$response['location']) {
            $this->returnLocationData['latitude'] = $response['location']['lat'];
            $this->returnLocationData['longitude'] = $response['location']['lng'];
        }
		else {
			throw new Exception(trans('location::errors.no_results'));
		}
	}
private function updateResponseWithResults ( $ json ) { $ response = $ this -> jsonToArray ( $ json ) ; if ( isset ( $ response [ 'results' ] [ 0 ] ) ) { $ this -> response = $ response [ 'results' ] [ 0 ] ; if ( @ $ response [ 'results' ] [ 0 ] [ 'partial_match' ] && $ this -> excludePartials ) { throw new Exception ( trans ( 'location::errors.no_results' ) ) ; } if ( ! $ this -> returnLocationData [ 'country' ] ) { $ this -> returnLocationData [ 'country' ] = $ this -> findInGoogleSet ( $ response , [ 'country' ] ) ; $ this -> returnLocationData [ 'iso' ] = $ this -> findInGoogleSet ( $ response , [ 'country' ] , 'short_name' ) ; } if ( ! $ this -> returnLocationData [ 'region' ] ) { $ this -> returnLocationData [ 'region' ] = $ this -> findInGoogleSet ( $ response , [ 'administrative_area_level_1' ] ) ; } if ( ! $ this -> returnLocationData [ 'city' ] ) { $ this -> returnLocationData [ 'city' ] = $ this -> findInGoogleSet ( $ response , [ 'administrative_area_level_2' ] ) ; } if ( ! $ this -> returnLocationData [ 'street' ] ) { $ this -> returnLocationData [ 'street' ] = $ this -> findInGoogleSet ( $ response , [ 'route' ] ) ; } if ( ! $ this -> returnLocationData [ 'street_number' ] ) { $ this -> returnLocationData [ 'street_number' ] = $ this -> findInGoogleSet ( $ response , [ 'street_number' ] ) ; } if ( ! $ this -> returnLocationData [ 'postal_code' ] ) { $ this -> returnLocationData [ 'postal_code' ] = $ this -> findInGoogleSet ( $ response , [ 'postal_code' ] ) ; } if ( ! $ this -> returnLocationData [ 'latitude' ] ) { $ this -> returnLocationData [ 'latitude' ] = $ response [ 'results' ] [ 0 ] [ 'geometry' ] [ 'location' ] [ 'lat' ] ; } if ( ! $ this -> returnLocationData [ 'longitude' ] ) { $ this -> returnLocationData [ 'longitude' ] = $ response [ 'results' ] [ 0 ] [ 'geometry' ] [ 'location' ] [ 'lng' ] ; } } elseif ( @ $ response [ 'location' ] ) { $ this -> returnLocationData [ 'latitude' ] = $ response [ 'location' ] [ 'lat' ] ; $ this -> returnLocationData [ 'longitude' ] = $ response [ 'location' ] [ 'lng' ] ; } else { throw new Exception ( trans ( 'location::errors.no_results' ) ) ; } }
fill the response with usefull data as far as we can find
fill the response with usefull data as far as we can find