22 lines
396 B
PHP
22 lines
396 B
PHP
<?php
|
|
|
|
namespace demo\Creational\FactoryMethod;
|
|
|
|
class FileLogger implements Logger
|
|
{
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
private string $filePath;
|
|
|
|
public function __construct(string $filePath)
|
|
{
|
|
$this->filePath = $filePath;
|
|
}
|
|
|
|
public function log(string $message)
|
|
{
|
|
file_put_contents($this->filePath, $message . PHP_EOL, FILE_APPEND);
|
|
}
|
|
} |