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 | 9 | public function __construct(ClientInterface $client) |
|
42 | |||
43 | /* ----------------------------------------------------------------- |
||
44 | | Main Methods |
||
45 | | ----------------------------------------------------------------- |
||
46 | */ |
||
47 | |||
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 | 3 | public function geocode($address, array $options = []) |
|
64 | |||
65 | /** |
||
66 | * Reverse geocoding (address lookup). |
||
67 | * |
||
68 | * @param \Arcanedev\GeoLocation\Contracts\Entities\Coordinates\Position $position |
||
69 | * @param array $options |
||
70 | * |
||
71 | * @return \Arcanedev\GeoLocation\Google\Geocoding\GeocodingResponse |
||
72 | */ |
||
73 | 3 | 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 | 3 | public function reversePosition($lat, $long, array $options = []) |
|
95 | |||
96 | /* ----------------------------------------------------------------- |
||
97 | | Other Methods |
||
98 | | ----------------------------------------------------------------- |
||
99 | */ |
||
100 | |||
101 | /** |
||
102 | * Get the default query params. |
||
103 | * |
||
104 | * @return array |
||
105 | */ |
||
106 | 6 | protected function getDefaultQueryParams() |
|
112 | |||
113 | /** |
||
114 | * Prepare the response. |
||
115 | * |
||
116 | * @param \Psr\Http\Message\ResponseInterface $response |
||
117 | * |
||
118 | * @return \Arcanedev\GeoLocation\Google\Geocoding\GeocodingResponse |
||
119 | */ |
||
120 | 6 | protected function prepareResponse(ResponseInterface $response) |
|
126 | } |
||
127 |