@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | /** |
53 | 53 | * Constructor |
54 | 54 | * @param string $application_url Contain url of the current application |
55 | - * @param Guzzle\Client|null $http_client Client object from Guzzle |
|
55 | + * @param null|Client $http_client Client object from Guzzle |
|
56 | 56 | */ |
57 | 57 | public function __construct( |
58 | 58 | $application_url, |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | /** |
112 | 112 | * Returns a new search object based on the base search. |
113 | 113 | * |
114 | - * @return Search |
|
114 | + * @return Reverse |
|
115 | 115 | */ |
116 | 116 | public function newReverse() |
117 | 117 | { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | /** |
148 | 148 | * Runs the query and returns the result set from Nominatim. |
149 | - * @param NominatimInterface $nRequest The object request to send |
|
149 | + * @param QueryInterface $nRequest The object request to send |
|
150 | 150 | * |
151 | 151 | * @return array The decoded data returned from Nominatim |
152 | 152 | * @throws \GuzzleHttp\Exception\ClientException if http request is an error |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | /** |
173 | 173 | * Return the client using by instance |
174 | - * @return GuzzleHttp\Client |
|
174 | + * @return Client |
|
175 | 175 | */ |
176 | 176 | public function getClient() |
177 | 177 | { |
@@ -11,7 +11,6 @@ |
||
11 | 11 | use GuzzleHttp\Client; |
12 | 12 | use GuzzleHttp\Psr7\Request; |
13 | 13 | use GuzzleHttp\Psr7\Response; |
14 | - |
|
15 | 14 | use maxh\Nominatim\Exceptions\InvalidParameterException; |
16 | 15 | use maxh\Nominatim\Exceptions\NominatimException; |
17 | 16 |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | 'connection_timeout' => 5, |
73 | 73 | ]); |
74 | 74 | } |
75 | - else if($http_client instanceof Client) |
|
75 | + else if ($http_client instanceof Client) |
|
76 | 76 | { |
77 | 77 | $application_url_client = $http_client->getConfig('base_uri'); |
78 | 78 | |
79 | - if(!isset($application_url_client)) |
|
79 | + if (!isset($application_url_client)) |
|
80 | 80 | { |
81 | 81 | $http_client->setDefaultOption('base_uri', $application_url); |
82 | 82 | } |
83 | - else if($application_url_client != $application_url) |
|
83 | + else if ($application_url_client != $application_url) |
|
84 | 84 | { |
85 | 85 | throw new InvalidParameterException("http_client parameter has a differente url to application_url parameter"); |
86 | 86 | } |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | throw new InvalidParameterException("http_client parameter must be a GuzzleHttp\Client object or empty"); |
91 | 91 | } |
92 | 92 | |
93 | - $this->application_url = $application_url; |
|
94 | - $this->http_client = $http_client; |
|
93 | + $this->application_url = $application_url; |
|
94 | + $this->http_client = $http_client; |
|
95 | 95 | |
96 | 96 | //Create base |
97 | 97 | $this->baseSearch = new Search(); |
@@ -131,12 +131,12 @@ discard block |
||
131 | 131 | private function decodeResponse($format, Request $request, Response $response) |
132 | 132 | { |
133 | 133 | |
134 | - if($format == 'json') |
|
134 | + if ($format == 'json') |
|
135 | 135 | { |
136 | 136 | return json_decode($response->getBody(), true); |
137 | 137 | } |
138 | 138 | |
139 | - if($format == 'xml') |
|
139 | + if ($format == 'xml') |
|
140 | 140 | { |
141 | 141 | return new \SimpleXMLElement($response->getBody()); |
142 | 142 | } |
@@ -71,21 +71,18 @@ |
||
71 | 71 | 'timeout' => 30, |
72 | 72 | 'connection_timeout' => 5, |
73 | 73 | ]); |
74 | - } |
|
75 | - else if($http_client instanceof Client) |
|
74 | + } else if($http_client instanceof Client) |
|
76 | 75 | { |
77 | 76 | $application_url_client = $http_client->getConfig('base_uri'); |
78 | 77 | |
79 | 78 | if(!isset($application_url_client)) |
80 | 79 | { |
81 | 80 | $http_client->setDefaultOption('base_uri', $application_url); |
82 | - } |
|
83 | - else if($application_url_client != $application_url) |
|
81 | + } else if($application_url_client != $application_url) |
|
84 | 82 | { |
85 | 83 | throw new InvalidParameterException("http_client parameter has a differente url to application_url parameter"); |
86 | 84 | } |
87 | - } |
|
88 | - else |
|
85 | + } else |
|
89 | 86 | { |
90 | 87 | throw new InvalidParameterException("http_client parameter must be a GuzzleHttp\Client object or empty"); |
91 | 88 | } |
@@ -20,9 +20,9 @@ discard block |
||
20 | 20 | use QueryTrait; |
21 | 21 | |
22 | 22 | /** |
23 | - * Output format accepted |
|
24 | - * @var array |
|
25 | - */ |
|
23 | + * Output format accepted |
|
24 | + * @var array |
|
25 | + */ |
|
26 | 26 | public $accepteFormat = ['html', 'xml', 'json', 'jsonv2']; |
27 | 27 | |
28 | 28 | /** |
@@ -246,12 +246,12 @@ discard block |
||
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
249 | - * Include a breakdown of the address into elements. |
|
250 | - * |
|
251 | - * @param boolean $details |
|
252 | - * |
|
253 | - * @return maxh\Nominatim\Search |
|
254 | - */ |
|
249 | + * Include a breakdown of the address into elements. |
|
250 | + * |
|
251 | + * @param boolean $details |
|
252 | + * |
|
253 | + * @return maxh\Nominatim\Search |
|
254 | + */ |
|
255 | 255 | public function addressDetails($details = true) |
256 | 256 | { |
257 | 257 | $this->query['addressdetails'] = $details ? "1" : "0"; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function __construct(array $query = []) |
39 | 39 | { |
40 | - if(!isset($query['format'])) |
|
40 | + if (!isset($query['format'])) |
|
41 | 41 | { |
42 | 42 | //Default format |
43 | 43 | $query['format'] = 'json'; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | { |
64 | 64 | $format = strtolower($format); |
65 | 65 | |
66 | - if(in_array($format, $this->accepteFormat)) |
|
66 | + if (in_array($format, $this->accepteFormat)) |
|
67 | 67 | { |
68 | 68 | $this->query['format'] = $format; |
69 | 69 | $this->setFormat($format); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | { |
270 | 270 | $args = func_get_args(); |
271 | 271 | |
272 | - if(count($args) > 0) |
|
272 | + if (count($args) > 0) |
|
273 | 273 | { |
274 | 274 | $this->query['exclude_place_ids'] = implode(', ', $args); |
275 | 275 | |
@@ -303,9 +303,9 @@ discard block |
||
303 | 303 | */ |
304 | 304 | public function polygon($polygon) |
305 | 305 | { |
306 | - if(in_array($polygon, $this->polygon)) |
|
306 | + if (in_array($polygon, $this->polygon)) |
|
307 | 307 | { |
308 | - $this->query['polygon_'.$polygon] = "1"; |
|
308 | + $this->query['polygon_' . $polygon] = "1"; |
|
309 | 309 | |
310 | 310 | return $this; |
311 | 311 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct(array $query = []) |
46 | 46 | { |
47 | - if(!isset($query['format'])) |
|
47 | + if (!isset($query['format'])) |
|
48 | 48 | { |
49 | 49 | //Default format |
50 | 50 | $query['format'] = 'json'; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | $format = strtolower($format); |
72 | 72 | |
73 | - if(in_array($format, $this->accepteFormat)) |
|
73 | + if (in_array($format, $this->accepteFormat)) |
|
74 | 74 | { |
75 | 75 | $this->query['format'] = $format; |
76 | 76 | $this->setFormat($format); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function osmType($type) |
111 | 111 | { |
112 | - if(in_array($type, $this->osmType)) |
|
112 | + if (in_array($type, $this->osmType)) |
|
113 | 113 | { |
114 | 114 | $this->query['osm_type'] = $type; |
115 | 115 | |
@@ -189,9 +189,9 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function polygon($polygon) |
191 | 191 | { |
192 | - if(in_array($polygon, $this->polygon)) |
|
192 | + if (in_array($polygon, $this->polygon)) |
|
193 | 193 | { |
194 | - $this->query['polygon_'.$polygon] = "1"; |
|
194 | + $this->query['polygon_' . $polygon] = "1"; |
|
195 | 195 | |
196 | 196 | return $this; |
197 | 197 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | $result = $instance->find($Search); |
20 | 20 | |
21 | -echo 'URL : ' . $url . $Search->getPath() . '?'. $Search->getQueryString(); |
|
21 | +echo 'URL : ' . $url . $Search->getPath() . '?' . $Search->getQueryString(); |
|
22 | 22 | |
23 | 23 | |
24 | 24 | var_dump($result); |
25 | 25 | \ No newline at end of file |