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.
34 lines
609 B
PHP
34 lines
609 B
PHP
<?php
|
|
|
|
namespace IndifferentKetchup\Codex\Log\File;
|
|
|
|
/**
|
|
* Class LogFile
|
|
*
|
|
* @package IndifferentKetchup\Codex\Log\File
|
|
*/
|
|
abstract class LogFile implements LogFileInterface
|
|
{
|
|
protected ?string $content = null;
|
|
protected ?string $path = null;
|
|
|
|
/**
|
|
* Get the log file content
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getContent(): string
|
|
{
|
|
return $this->content;
|
|
}
|
|
|
|
/**
|
|
* Get the source path of the log file when one is known
|
|
*
|
|
* @return string|null
|
|
*/
|
|
public function getPath(): ?string
|
|
{
|
|
return $this->path;
|
|
}
|
|
} |