Skip to content

Commit

Permalink
Merge pull request #95 from creative-commoners/pulls/4.1/remove-self
Browse files Browse the repository at this point in the history
ENH Use class name instead of self
  • Loading branch information
GuySartorelli authored Jun 17, 2024
2 parents a26a5c0 + 7149050 commit f70ad81
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/Cache/FileTextCache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -77,7 +77,7 @@ public function save(File $file, $content)
*/
public static function flush()
{
$cache = self::get_cache();
$cache = Cache::get_cache();
$cache->clear();
}

Expand All @@ -88,7 +88,7 @@ public static function flush()
*/
public static function clear()
{
$cache = self::get_cache();
$cache = Cache::get_cache();
$cache->clear();
}

Expand All @@ -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);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Extractor/FileTextExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
}

/**
Expand Down Expand Up @@ -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()) {
Expand Down

0 comments on commit f70ad81

Please sign in to comment.