From 714905014702ad15eae5ec29d5021f8a330d80f4 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 5 Jun 2024 16:35:57 +1200 Subject: [PATCH] ENH Use class name instead of self --- src/Cache/FileTextCache/Cache.php | 10 +++++----- src/Extractor/FileTextExtractor.php | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Cache/FileTextCache/Cache.php b/src/Cache/FileTextCache/Cache.php index b5b2934..564050a 100644 --- a/src/Cache/FileTextCache/Cache.php +++ b/src/Cache/FileTextCache/Cache.php @@ -53,7 +53,7 @@ protected function getKey(File $file) 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 @@ public function save(File $file, $content) { $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 @@ public function save(File $file, $content) */ public static function flush() { - $cache = self::get_cache(); + $cache = Cache::get_cache(); $cache->clear(); } @@ -88,7 +88,7 @@ public static function flush() */ public static function clear() { - $cache = self::get_cache(); + $cache = Cache::get_cache(); $cache->clear(); } @@ -100,7 +100,7 @@ public static function clear() public function invalidate(File $file) { $key = $this->getKey($file); - $cache = self::get_cache(); + $cache = Cache::get_cache(); return $cache->delete($key); } diff --git a/src/Extractor/FileTextExtractor.php b/src/Extractor/FileTextExtractor.php index 8f2ee1b..5a4ed5d 100644 --- a/src/Extractor/FileTextExtractor.php +++ b/src/Extractor/FileTextExtractor.php @@ -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 @@ protected static function get_extractor_classes() // Save classes $sortedClasses = array_keys($classPriorities ?? []); - return self::$sorted_extractor_classes = $sortedClasses; + return FileTextExtractor::$sorted_extractor_classes = $sortedClasses; } /** @@ -95,8 +95,8 @@ public static function for_file($file) $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()) {