Skip to content

Commit 970c8f8

Browse files
committed
refactoring
1 parent 66c08e3 commit 970c8f8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/RobotLoader/RobotLoader.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class RobotLoader
2828
{
2929
use Nette\SmartObject;
3030

31-
private const RETRY_LIMIT = 3;
31+
private const RetryLimit = 3;
3232

3333
/** @var string[] */
3434
public $ignoreDirs = ['.*', '*.old', '*.bak', '*.tmp', 'temp'];
@@ -104,7 +104,7 @@ public function tryLoad(string $type): void
104104
$this->loadCache();
105105

106106
$missing = $this->missingClasses[$type] ?? null;
107-
if ($missing >= self::RETRY_LIMIT) {
107+
if ($missing >= self::RetryLimit) {
108108
return;
109109
}
110110

@@ -126,7 +126,7 @@ public function tryLoad(string $type): void
126126

127127
if (!$file || !is_file($file)) {
128128
$this->missingClasses[$type] = ++$missing;
129-
$this->needSave = $this->needSave || $file || ($missing <= self::RETRY_LIMIT);
129+
$this->needSave = $this->needSave || $file || ($missing <= self::RetryLimit);
130130
unset($this->classes[$type]);
131131
$file = null;
132132
}
@@ -479,7 +479,7 @@ private function loadCache(): void
479479

480480
$this->cacheLoaded = true;
481481

482-
$file = $this->getCacheFile();
482+
$file = $this->generateCacheFileName();
483483

484484
// Solving atomicity to work everywhere is really pain in the ass.
485485
// 1) We want to do as little as possible IO calls on production and also directory and file can be not writable (#19)
@@ -525,7 +525,7 @@ private function saveCache($lock = null): void
525525
// we have to acquire a lock to be able safely rename file
526526
// on Linux: that another thread does not rename the same named file earlier
527527
// on Windows: that the file is not read by another thread
528-
$file = $this->getCacheFile();
528+
$file = $this->generateCacheFileName();
529529
$lock = $lock ?: $this->acquireLock("$file.lock", LOCK_EX);
530530
$code = "<?php\nreturn " . var_export([$this->classes, $this->missingClasses, $this->emptyFiles], true) . ";\n";
531531

@@ -559,7 +559,7 @@ private function acquireLock(string $file, int $mode)
559559
}
560560

561561

562-
private function getCacheFile(): string
562+
private function generateCacheFileName(): string
563563
{
564564
if (!$this->tempDirectory) {
565565
throw new \LogicException('Set path to temporary directory using setTempDirectory().');

0 commit comments

Comments
 (0)