feat: use bridge description and short name in search (#2952)

* refactor: search.js

* feat: use bridge description and short name in search

* fix bug in previous merge commit

Also reformat string from tabs to spaces
This commit is contained in:
Dag 2022-08-06 23:12:30 +02:00 committed by GitHub
parent eef45d4e8d
commit 502799a74c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 74 additions and 74 deletions

View file

@ -264,7 +264,7 @@ abstract class BridgeAbstract implements BridgeInterface
public function loadConfiguration()
{
foreach (static::CONFIGURATION as $optionName => $optionValue) {
$section = (new ReflectionClass($this))->getShortName();
$section = $this->getShortName();
$configurationOption = Configuration::getConfig($section, $optionName);
if ($configurationOption !== null) {
@ -384,7 +384,7 @@ abstract class BridgeAbstract implements BridgeInterface
$cache = $cacheFactory->create();
// Create class name without the namespace part
$scope = (new \ReflectionClass($this))->getShortName();
$scope = $this->getShortName();
$cache->setScope($scope);
$cache->setKey($key);
if ($cache->getTime() < time() - $duration) {
@ -404,9 +404,14 @@ abstract class BridgeAbstract implements BridgeInterface
$cacheFactory = new CacheFactory();
$cache = $cacheFactory->create();
$scope = (new \ReflectionClass($this))->getShortName();
$scope = $this->getShortName();
$cache->setScope($scope);
$cache->setKey($key);
$cache->saveData($value);
}
public function getShortName(): string
{
return (new \ReflectionClass($this))->getShortName();
}
}