From 67a71276872b47f53ef8996988fb9817c613e42f Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Mon, 9 Jul 2018 10:59:02 -0400 Subject: [PATCH] Code simplification. --- module/VuFind/src/VuFind/Autocomplete/Eds.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/module/VuFind/src/VuFind/Autocomplete/Eds.php b/module/VuFind/src/VuFind/Autocomplete/Eds.php index 18094b556eb..2865685c2c5 100644 --- a/module/VuFind/src/VuFind/Autocomplete/Eds.php +++ b/module/VuFind/src/VuFind/Autocomplete/Eds.php @@ -84,20 +84,13 @@ class Eds implements AutocompleteInterface */ public function getSuggestions($query) { - // Initialize return array: - $results = []; - - if (!is_object($this->backend)) { - throw new \Exception('Please set configuration first.'); - } - try { // Perform the autocomplete search: $results = $this->backend->autocomplete($query, $this->domain); } catch (\Exception $e) { // Ignore errors -- just return empty results if we must. } - return isset($results) ? array_unique($results) : []; + return is_array($results ?? null) ? array_unique($results) : []; } /** -- GitLab