1 | <?php namespace Arcanedev\GeoLocation\Google\Geocoding; |
||
16 | class GeocodingService extends AbstractService |
||
17 | { |
||
18 | /* ----------------------------------------------------------------- |
||
19 | | Constants |
||
20 | | ----------------------------------------------------------------- |
||
21 | */ |
||
22 | |||
23 | const BASE_URL = 'https://maps.googleapis.com/maps/api/geocode/json'; |
||
24 | |||
25 | /* ----------------------------------------------------------------- |
||
26 | | Main Methods |
||
27 | | ----------------------------------------------------------------- |
||
28 | */ |
||
29 | |||
30 | /** |
||
31 | * Get the geocoding response. |
||
32 | * |
||
33 | * @param string $address |
||
34 | * @param array $options |
||
35 | * |
||
36 | * @return \Arcanedev\GeoLocation\Google\Geocoding\GeocodingResponse |
||
37 | */ |
||
38 | 3 | public function geocode($address, array $options = []) |
|
46 | |||
47 | /** |
||
48 | * Reverse geocoding (address lookup). |
||
49 | * |
||
50 | * @param \Arcanedev\GeoLocation\Contracts\Entities\Coordinates\Position $position |
||
51 | * @param array $options |
||
52 | * |
||
53 | * @return \Arcanedev\GeoLocation\Google\Geocoding\GeocodingResponse |
||
54 | */ |
||
55 | 3 | public function reverse(PositionContract $position, array $options = []) |
|
63 | |||
64 | /** |
||
65 | * Reverse geocoding (address lookup & simplified). |
||
66 | * |
||
67 | * @param float $lat |
||
68 | * @param float $long |
||
69 | * @param array $options |
||
70 | * |
||
71 | * @return \Arcanedev\GeoLocation\Google\Geocoding\GeocodingResponse |
||
72 | */ |
||
73 | 3 | public function reversePosition($lat, $long, array $options = []) |
|
77 | |||
78 | /* ----------------------------------------------------------------- |
||
79 | | Other Methods |
||
80 | | ----------------------------------------------------------------- |
||
81 | */ |
||
82 | |||
83 | /** |
||
84 | * Prepare the response. |
||
85 | * |
||
86 | * @param \Psr\Http\Message\ResponseInterface $response |
||
87 | * |
||
88 | * @return \Arcanedev\GeoLocation\Google\Geocoding\GeocodingResponse |
||
89 | */ |
||
90 | 6 | protected function prepareResponse(ResponseInterface $response) |
|
96 | } |
||
97 |