Skip to content
Snippets Groups Projects
Commit 67a71276 authored by Demian Katz's avatar Demian Katz
Browse files

Code simplification.

parent 091ecbda
No related merge requests found
......@@ -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) : [];
}
/**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment