Skip to content

Commit

Permalink
Some tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenguest committed May 3, 2019
1 parent f884ad0 commit dbf087e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Services/OpenStreetMap/Nominatim.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ public function getAddressdetails(): int
public function setAddressdetails(
int $addressdetails
): Services_OpenStreetMap_Nominatim {
$this->addressdetails = (int) $addressdetails;
$this->addressdetails = $addressdetails;

return $this;
}
Expand Down
46 changes: 22 additions & 24 deletions Services/OpenStreetMap/Transport/HTTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,20 @@ public function getResponse(

if (self::OK === $code) {
return $response;
} else {
$eMsg = 'Unexpected HTTP status: '
. $code . ' '
. $response->getReasonPhrase()
. ' [for ' . $response->getEffectiveUrl() . ']';
/**
* What text for the error was retrieved?
*
* @var string $error
*/
$error = $response->getHeader('error');
if (null !== $error) {
$eMsg .= " ($error)";
}
}

$eMsg = sprintf(
"Unexpected HTTP status: %s %s [for %s]", $code,
$response->getReasonPhrase(), $response->getEffectiveUrl()
);
/**
* What text for the error was retrieved?
*
* @var string $error
*/
$error = $response->getHeader('error');
if (null !== $error) {
$eMsg .= " ($error)";
}
} catch (HTTP_Request2_Exception $e) {
$this->log->warning((string)$e);
Expand Down Expand Up @@ -259,11 +259,10 @@ public function getObject(
}*/

$config = $this->getConfig()->asArray();
$url = $config['server']
. 'api/'
. $config['api_version']
. '/' . $type . '/'
. $id;
$url = sprintf(
"%sapi/%s/%s/%s", $config['server'], $config['api_version'], $type,
$id
);
if ($version !== null) {
$url .= "/$version";
if ($append !== null) {
Expand Down Expand Up @@ -312,11 +311,10 @@ public function getObjects(
*/
$response = null;
$config = $this->getConfig();
$url = $config->getValue('server')
. 'api/'
. $config->getValue('api_version')
. '/' . $type . 's?' . $type . 's='
. implode(',', $ids);
$url = sprintf(
"%sapi/%s/%ss?%ss=%s", $config->getValue('server'),
$config->getValue('api_version'), $type, $type, implode(',', $ids)
);
try {
$response = $this->getResponse($url);
} catch (Services_OpenStreetMap_Exception $ex) {
Expand Down

0 comments on commit dbf087e

Please sign in to comment.