Skip to content

Commit

Permalink
prepend() to abstract class
Browse files Browse the repository at this point in the history
  • Loading branch information
MartkCz committed May 4, 2022
1 parent d71f695 commit 87483a3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/Templates/Template/ParaisoTemplateObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,4 @@ private function toFullAddress(ISubject $subject): string
]));
}

private function prepend(string $prepend, ?string $str): ?string
{
return $str === null ? null : $prepend . $str;
}

}
18 changes: 18 additions & 0 deletions src/Templates/Template/TemplateObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,22 @@ public function formatMoneyCallback(): callable
return fn (string $money) => $this->order->getCurrency()->toString($money);
}

protected function prepend(string $prepend, ?string $str): ?string
{
return $str === null ? null : $prepend . $str;
}

/**
* @param mixed[] $items
*/
protected function implode(array $items, string $separator): ?string
{
$items = array_filter($items);
if (!$items) {
return null;
}

return implode($separator, $items);
}

}

0 comments on commit 87483a3

Please sign in to comment.