mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-01 13:07:22 +00:00
Optimize fil_exists()
This commit is contained in:
@@ -38,7 +38,7 @@ class FilesystemCache implements CacheInterface
|
||||
|
||||
public function load(string $key): void
|
||||
{
|
||||
if (file_exists($key)) {
|
||||
if (is_file($key)) {
|
||||
@include_once $key;
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ class FilesystemCache implements CacheInterface
|
||||
|
||||
public function getTimestamp(string $key): int
|
||||
{
|
||||
if (!file_exists($key)) {
|
||||
if (!is_file($key)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ final class ExtensionSet
|
||||
|
||||
foreach ($this->extensions as $extension) {
|
||||
$r = new \ReflectionObject($extension);
|
||||
if (file_exists($r->getFileName()) && ($extensionTime = filemtime($r->getFileName())) > $this->lastModified) {
|
||||
if (is_file($r->getFileName()) && ($extensionTime = filemtime($r->getFileName())) > $this->lastModified) {
|
||||
$this->lastModified = $extensionTime;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user