From 607f4465ad9187d34bd2a6761f03ac1ee2cc2072 Mon Sep 17 00:00:00 2001 From: Timon de Groot Date: Mon, 12 Mar 2018 23:08:52 +0100 Subject: [PATCH] Reformat Model\Validator::query() --- Model/Validator.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Model/Validator.php b/Model/Validator.php index 4042128..81fbe83 100644 --- a/Model/Validator.php +++ b/Model/Validator.php @@ -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;