Skip to content

Commit

Permalink
Reformat Model\Validator::query()
Browse files Browse the repository at this point in the history
  • Loading branch information
tdgroot committed Mar 12, 2018
1 parent 5254e03 commit 607f446
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Model/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,15 @@ private function query($prefix): array
return $this->serializer->unserialize($cacheEntry);
}

$hashes = [];

$this->httpClient->get(self::PWNED_BASE_URL . '/range/' . $prefix);

if ($this->httpClient->getStatus() !== 200) {
return $hashes;
return [];
}

$body = $this->httpClient->getBody();
$results = explode("\n", $body);

$hashes = [];
foreach ($results as $value) {
list($hash, $count) = explode(':', $value);
$hashes[$hash] = (int)$count;
Expand Down

0 comments on commit 607f446

Please sign in to comment.