class GenericEncoder
{
private $encoderFactory;
public function __construct(
EncoderFactory $encoderFactory
){
$this->encoderFactory = $encoderFactory;
}
public function encodeToFormat($data, string $format): string
{
$encoder = $this->encoderFactory
->createForFormat($format);
$data = $this->prepareData($data, $format);
return $encoder->encode($data);
}
}
The GenericEncoder Class Now Uses EncoderFactory
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.