refactored Factory Method pattern

This commit is contained in:
Dominik Liebler
2018-06-15 18:18:26 +02:00
parent f6d845e59e
commit bca6af02c0
27 changed files with 201 additions and 1198 deletions

View File

@@ -0,0 +1,21 @@
<?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);
}
}