From 5335de3f9803ec32316275387780db4723fba04e Mon Sep 17 00:00:00 2001 From: Attogram Project Date: Wed, 22 Apr 2020 09:51:42 +0200 Subject: [PATCH] json_decode assoc --- src/Topic.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Topic.php b/src/Topic.php index e26d0fb..fad970d 100644 --- a/src/Topic.php +++ b/src/Topic.php @@ -12,6 +12,7 @@ use function gmdate; use function in_array; use function is_array; +use function json_decode; use function json_encode; use function sort; use function substr; @@ -72,13 +73,15 @@ public function get() */ private function setDataFromCache() { - $this->data = json_decode($this->filesystem->get($this->topic)); - if (!is_array($this->data)) { + $this->data = $this->filesystem->get($this->topic); + if (!$this->data) { $this->data = []; return false; } + $this->data = json_decode($this->data, true); + return true; }