private function buildResults($results)
    {
        return array_map(function ($result) {
            $coordinates = $result['geometry']['location'];
            $data = [
                'address' => $result['formatted_address'],
                'latitude' => $coordinates['lat'],
                'longitude' => $coordinates['lng'],
                'place_id' => $result['place_id'],
                'types' => $result['types'],
                'address_components' => $this->buildAddressComponents($result)
            ];

            if (isset($result['geometry']['bounds'])) {
                $bounds = $result['geometry']['bounds'];
                $data['bounds'] = [
                    'northeast' => [
                        'latitude' => $bounds['northeast']['lat'],
                        'longitude' => $bounds['northeast']['lng'],
                    ],
                    'southwest' => [
                        'latitude' => $bounds['southwest']['lat'],
                        'longitude' => $bounds['southwest']['lng'],
                    ]
                ];
            }

            return $data;
        }, $results);
    }
private function buildResults($results)
    {
        return array_map(function ($result) {
            $coordinates = $result['geometry']['location'];
            $data = [
                'address' => $result['formatted_address'],
                'latitude' => $coordinates['lat'],
                'longitude' => $coordinates['lng'],
                'place_id' => $result['place_id'],
                'types' => $result['types'],
                'address_components' => $this->buildAddressComponents($result)
            ];

            if (isset($result['geometry']['bounds'])) {
                $bounds = $result['geometry']['bounds'];
                $data['bounds'] = [
                    'northeast' => [
                        'latitude' => $bounds['northeast']['lat'],
                        'longitude' => $bounds['northeast']['lng'],
                    ],
                    'southwest' => [
                        'latitude' => $bounds['southwest']['lat'],
                        'longitude' => $bounds['southwest']['lng'],
                    ]
                ];
            }

            return $data;
        }, $results);
    }
private function buildResults ( $ results ) { return array_map ( function ( $ result ) { $ coordinates = $ result [ 'geometry' ] [ 'location' ] ; $ data = [ 'address' => $ result [ 'formatted_address' ] , 'latitude' => $ coordinates [ 'lat' ] , 'longitude' => $ coordinates [ 'lng' ] , 'place_id' => $ result [ 'place_id' ] , 'types' => $ result [ 'types' ] , 'address_components' => $ this -> buildAddressComponents ( $ result ) ] ; if ( isset ( $ result [ 'geometry' ] [ 'bounds' ] ) ) { $ bounds = $ result [ 'geometry' ] [ 'bounds' ] ; $ data [ 'bounds' ] = [ 'northeast' => [ 'latitude' => $ bounds [ 'northeast' ] [ 'lat' ] , 'longitude' => $ bounds [ 'northeast' ] [ 'lng' ] , ] , 'southwest' => [ 'latitude' => $ bounds [ 'southwest' ] [ 'lat' ] , 'longitude' => $ bounds [ 'southwest' ] [ 'lng' ] , ] ] ; } return $ data ; } , $ results ) ; }
Transform the response from Google into a result set.

@param $results
@return array
Transform the response from Google into a result set .