Skip to content

Commit 4cf9df5

Browse files
committed
clean code
1 parent f713ac7 commit 4cf9df5

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/Rotation.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,34 +31,31 @@ public function rotate(string $file): ?string
3131
return null;
3232
}
3333

34-
$this->initProcessorFile($file);
35-
3634
$fileRotate = $this->moveContentToTempFile($file);
3735

38-
return $this->runProcessors($fileRotate);
36+
return $this->runProcessors($file, $fileRotate);
3937
}
4038

4139
/**
4240
* Run all processors
4341
*
44-
* @param string|null $fileRotate
42+
* @param string $originalFile
43+
* @param string|null $fileRotated
4544
* @return string|null
4645
*/
47-
private function runProcessors(?string $fileRotate): ?string
46+
private function runProcessors(string $originalFile, ?string $fileRotated): ?string
4847
{
49-
if (!$fileRotate) {
50-
return null;
51-
}
48+
$this->initProcessorFile($originalFile);
5249

5350
foreach ($this->processors as $processor) {
54-
$fileRotate = $processor->handler($fileRotate);
55-
56-
if (!$fileRotate) {
51+
if (!$fileRotated) {
5752
return null;
5853
}
54+
55+
$fileRotated = $processor->handler($fileRotated);
5956
}
6057

61-
return $fileRotate;
58+
return $fileRotated;
6259
}
6360

6461
/**

0 commit comments

Comments
 (0)