Expose source path on LogFileInterface

Add LogFileInterface::getPath(): ?string so detectors can dispatch on a
filename hint when the original path is known. Default implementation on
the abstract LogFile base returns null; PathLogFile records its
constructor argument. StringLogFile and StreamLogFile inherit the null
default. Tests cover both the path and null-fallback cases.
This commit is contained in:
2026-04-30 20:29:21 +00:00
parent e709389e08
commit 8ae7da5259
5 changed files with 38 additions and 0 deletions

View File

@@ -14,4 +14,12 @@ class PathLogFileTest extends TestCase
$this->assertStringEqualsFile($path, $logFile->getContent());
}
public function testGetPathReturnsConstructorArgument(): void
{
$path = __DIR__ . "/../../../data/simple.log";
$logFile = new PathLogFile($path);
$this->assertSame($path, $logFile->getPath());
}
}