designModeDemo/demo/Creational/FactoryMethod/FileLoggerFactory.php

24 lines
414 B
PHP

<?php
namespace demo\Creational\FactoryMethod;
use JetBrains\PhpStorm\Pure;
class FileLoggerFactory implements LoggerFactory
{
/**
* @var string
*/
private string $filePath;
public function __construct(string $filePath)
{
$this->filePath = $filePath;
}
public function createLogger() : Logger
{
return new FileLogger($this->filePath);
}
}