1 | <?php namespace Arcanedev\GeoLocation\Google\Geocoding; |
||
17 | class GeocodingService extends AbstractService |
||
18 | { |
||
19 | /* ----------------------------------------------------------------- |
||
20 | | Constants |
||
21 | | ----------------------------------------------------------------- |
||
22 | */ |
||
23 | |||
24 | const BASE_URL = 'https://maps.googleapis.com/maps/api/geocode/json'; |
||
25 | |||
26 | /* ----------------------------------------------------------------- |
||
27 | | Constructor |
||
28 | | ----------------------------------------------------------------- |
||
29 | */ |
||
30 | |||
31 | /** |
||
32 | * GoogleDistanceMatrix constructor. |
||
33 | * |
||
34 | * @param \GuzzleHttp\ClientInterface $client |
||
35 | */ |
||
36 | public function __construct(ClientInterface $client) |
||
42 | |||
43 | 6 | /* ----------------------------------------------------------------- |
|
44 | | Main Methods |
||
45 | 6 | | ----------------------------------------------------------------- |
|
46 | 6 | */ |
|
47 | 6 | ||
48 | /** |
||
49 | * Get the geocoding response. |
||
50 | * |
||
51 | * @param string $address |
||
52 | * @param array $options |
||
53 | * |
||
54 | * @return \Arcanedev\GeoLocation\Google\Geocoding\GeocodingResponse |
||
55 | */ |
||
56 | public function geocode($address, array $options = []) |
||
64 | |||
65 | 6 | /** |
|
66 | * Reverse geocoding (address lookup). |
||
67 | * |
||
68 | * @param \Arcanedev\GeoLocation\Contracts\Entities\Position $position |
||
69 | * @param array $options |
||
70 | * |
||
71 | * @return \Arcanedev\GeoLocation\Google\Geocoding\GeocodingResponse |
||
72 | */ |
||
73 | public function reverse(PositionContract $position, array $options = []) |
||
81 | |||
82 | /** |
||
83 | * Reverse geocoding (address lookup & simplified). |
||
84 | * |
||
85 | * @param float $lat |
||
86 | * @param float $long |
||
87 | * @param array $options |
||
88 | * |
||
89 | * @return \Arcanedev\GeoLocation\Google\Geocoding\GeocodingResponse |
||
90 | */ |
||
91 | public function reversePosition($lat, $long, array $options = []) |
||
95 | 3 | ||
96 | /* ----------------------------------------------------------------- |
||
97 | 3 | | Other Methods |
|
98 | | ----------------------------------------------------------------- |
||
99 | 3 | */ |
|
100 | |||
101 | 3 | /** |
|
102 | 3 | * Get the default query params. |
|
103 | 1 | * |
|
104 | * @return array |
||
105 | */ |
||
106 | protected function getDefaultQueryParams() |
||
112 | |||
113 | 3 | /** |
|
114 | * Prepare the response. |
||
115 | 3 | * |
|
116 | 3 | * @param \Psr\Http\Message\ResponseInterface $response |
|
117 | 3 | * |
|
118 | 1 | * @return \Arcanedev\GeoLocation\Google\Geocoding\GeocodingResponse |
|
119 | */ |
||
120 | 3 | protected function prepareResponse(ResponseInterface $response) |
|
126 | } |
||
127 |