mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-22 07:41:15 +02:00
22 lines
412 B
PHP
22 lines
412 B
PHP
<?php declare(strict_types=1);
|
|
|
|
namespace DesignPatterns\Creational\FactoryMethod;
|
|
|
|
class FileLogger implements Logger
|
|
{
|
|
/**
|
|
* @var string
|
|
*/
|
|
private $filePath;
|
|
|
|
public function __construct(string $filePath)
|
|
{
|
|
$this->filePath = $filePath;
|
|
}
|
|
|
|
public function log(string $message)
|
|
{
|
|
file_put_contents($this->filePath, $message . PHP_EOL, FILE_APPEND);
|
|
}
|
|
}
|