Files
DesignPatternsPHP/Creational/FactoryMethod/FileLogger.php
2019-12-14 13:41:03 +01:00

19 lines
384 B
PHP

<?php declare(strict_types=1);
namespace DesignPatterns\Creational\FactoryMethod;
class FileLogger implements Logger
{
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);
}
}