Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Use class name instead of self #95

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading