Skip to content

Commit

Permalink
fix apiCep quando retorna o content acaba retornando sem o adress
Browse files Browse the repository at this point in the history
  • Loading branch information
Kallef Alexandre committed Jul 1, 2020
1 parent 3e645c5 commit c7e0926
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/CepGratis.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static function search(string $cep, array $options = [], int $timeout = n
* Performs provider CEP search.
*
* @param string $cep CEP
* @return Contracts\Address
* @return Address
* @throws CepGratisInvalidParameterException
* @throws CepGratisTimeoutException
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Providers/ApiCepProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function getAddress($cep, HttpClientContract $client, array $option = [])
}

$address = '';
if ($content->address) {
if (property_exists($content, 'address') && $content->address) {
$address = trim(explode('- até', $content->address)[0] ?? '');
$address = trim(explode('- de', $address)[0] ?? '');
}
Expand Down

0 comments on commit c7e0926

Please sign in to comment.