Skip to content

Commit

Permalink
fix indent
Browse files Browse the repository at this point in the history
  • Loading branch information
codescheme committed Feb 20, 2017
1 parent 4ca1270 commit 6f1187b
Showing 1 changed file with 26 additions and 23 deletions.
49 changes: 26 additions & 23 deletions src/Classes/Postcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ public function __construct()
'Accept' => 'application/json',
];

$this->client = new Client(['base_uri' => $this->base_uri, 'headers' => $this->headers, 'http_errors' => false, 'verify' => __DIR__ . '/../cacert.pem']);
$this->client = new Client([
'base_uri' => $this->base_uri,
'headers' => $this->headers,
'http_errors' => false,
'verify' => __DIR__ . '/../cacert.pem'
]);
}

/**
Expand All @@ -52,14 +57,14 @@ public function validate($postcode)
$request = new Request('GET', $url);
$response = $this->httpTransport($request);

return ($response && (200 === $response->status) && $response->result);
return ($response && (200 === $response->status) && $response->result);
}

/**
* Find nearest postcodes to given
*
* @param string $postcode
* @return object | null on Exception
* @param string $postcode
* @return object | null on Exception
*/
public function nearest($postcode)
{
Expand All @@ -73,7 +78,7 @@ public function nearest($postcode)
* Get postcode from coordinates
*
* @params string $lon, $lat the coordinates
* @return object | null on Exception
* @return object | null on Exception
*/
public function reverseGeocode($lon, $lat)
{
Expand All @@ -84,10 +89,10 @@ public function reverseGeocode($lon, $lat)
}

/**
* Autocomplete a postcode,
* Autocomplete a postcode,
*
* @param string $postcode, partial, especially outcode
* @return object | null on Exception
* @param string $postcode, partial, especially outcode
* @return object | null on Exception
*/
public function autocomplete($postcode)
{
Expand All @@ -98,10 +103,10 @@ public function autocomplete($postcode)
}

/**
* Look up a postcode,
* Look up a postcode,
*
* @param string $postcode,
* @return object | null on Exception
* @param string $postcode,
* @return object | null on Exception
*/
public function postcodeLookup($postcode)
{
Expand All @@ -112,24 +117,24 @@ public function postcodeLookup($postcode)
}

/**
* Look up a outcode,
* Look up a outcode,
*
* @param string $outcode,
* @return object | null on Exception
* @param string $outcode,
* @return object | null on Exception
*/
public function outcodeLookup($outcode)
{
$url = '/outcodes/' . rawurlencode($outcode);
$request = new Request('GET', $url);

return $this->httpTransport($request);
}
}

/**
* Bulk information lookup for multiple postcodes
*
* @param array $postcodes
* @return object | null on RequestException
* @param array $postcodes
* @return object | null on RequestException
*/
public function postcodeLookupBulk($postcodes)
{
Expand Down Expand Up @@ -167,12 +172,10 @@ public function reverseGeocodeBulk($geolocations)
protected function httpTransport($request)
{

try {
$response = $this->client->send($request);
$results = json_decode($response->getBody());

return $results;

try {
$response = $this->client->send($request);
$results = json_decode($response->getBody());
return $results;
} catch (RequestException $e) {
Log::error(Psr7\str($e->getRequest()));
if ($e->hasResponse()) {
Expand Down

0 comments on commit 6f1187b

Please sign in to comment.