Skip to content

Commit

Permalink
added setFormatNewLine()
Browse files Browse the repository at this point in the history
  • Loading branch information
jgniecki committed Jun 22, 2024
1 parent a3eee81 commit 8869fe1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Generator/HtmlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@ class HtmlGenerator implements GeneratorInterface
private FormatCollection $formatCollection;
private ColorCollection $colorCollection;

private $formatNewLine = "%s<br />";


public function __construct(?FormatCollection $formatCollection = null, ?ColorCollection $colorCollection = null)
{
$this->formatCollection = $formatCollection ?? FormatCollection::generate();
$this->colorCollection = $colorCollection ?? ColorCollection::generate();
}

public function setFormatNewLine(string $format): void
{
$this->formatNewLine = $format;
}

public function generate(MotdItemCollection $collection): string
{
$result = "";
Expand All @@ -28,7 +35,7 @@ public function generate(MotdItemCollection $collection): string
continue;

if ($motdItem->getText() == "\n") {
$result .= "<br />";
$result = \sprintf($this->formatNewLine, $result);
continue;
}

Expand Down

0 comments on commit 8869fe1

Please sign in to comment.