Files
DesignPatternsPHP/Creational/FactoryMethod/FileLogger.php
2018-06-15 18:18:26 +02:00

22 lines
387 B
PHP

<?php
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);
}
}