ENH Use class name instead of self

This commit is contained in:
Steve Boyd 2024-06-05 16:35:57 +12:00
parent a26a5c05b0
commit 7149050147
2 changed files with 10 additions and 10 deletions

View File

@ -53,7 +53,7 @@ class Cache implements FileTextCache, Flushable
public function load(File $file)
{
$key = $this->getKey($file);
$cache = self::get_cache();
$cache = Cache::get_cache();
return $cache->get($key);
}
@ -67,7 +67,7 @@ class Cache implements FileTextCache, Flushable
{
$lifetime = $this->config()->get('lifetime') ?: 3600;
$key = $this->getKey($file);
$cache = self::get_cache();
$cache = Cache::get_cache();
return $cache->set($key, $content, $lifetime);
}
@ -77,7 +77,7 @@ class Cache implements FileTextCache, Flushable
*/
public static function flush()
{
$cache = self::get_cache();
$cache = Cache::get_cache();
$cache->clear();
}
@ -88,7 +88,7 @@ class Cache implements FileTextCache, Flushable
*/
public static function clear()
{
$cache = self::get_cache();
$cache = Cache::get_cache();
$cache->clear();
}
@ -100,7 +100,7 @@ class Cache implements FileTextCache, Flushable
public function invalidate(File $file)
{
$key = $this->getKey($file);
$cache = self::get_cache();
$cache = Cache::get_cache();
return $cache->delete($key);
}

View File

@ -43,8 +43,8 @@ abstract class FileTextExtractor
protected static function get_extractor_classes()
{
// Check cache
if (self::$sorted_extractor_classes) {
return self::$sorted_extractor_classes;
if (FileTextExtractor::$sorted_extractor_classes) {
return FileTextExtractor::$sorted_extractor_classes;
}
// Generate the sorted list of extractors on demand.
@ -59,7 +59,7 @@ abstract class FileTextExtractor
// Save classes
$sortedClasses = array_keys($classPriorities ?? []);
return self::$sorted_extractor_classes = $sortedClasses;
return FileTextExtractor::$sorted_extractor_classes = $sortedClasses;
}
/**
@ -95,8 +95,8 @@ abstract class FileTextExtractor
$extension = $file->getExtension();
$mime = $file->getMimeType();
foreach (self::get_extractor_classes() as $className) {
$extractor = self::get_extractor($className);
foreach (FileTextExtractor::get_extractor_classes() as $className) {
$extractor = FileTextExtractor::get_extractor($className);
// Skip unavailable extractors
if (!$extractor->isAvailable()) {