Skip to content

Instantly share code, notes, and snippets.

@chrisharrison
Last active August 31, 2019 17:09
Show Gist options
  • Save chrisharrison/296c1b7b7d316c51cab7487b2d5023dc to your computer and use it in GitHub Desktop.
Save chrisharrison/296c1b7b7d316c51cab7487b2d5023dc to your computer and use it in GitHub Desktop.
final class ProduceStatementOfAccountHandler
{
private $pdfGenerator;
private $dataProvider;
public function __construct(
PdfGenerator $pdfGenerator,
DefaultDataProvider $dataProvider
) {
$this->pdfGenerator = $pdfGenerator;
$this->dataProvider = $dataProvider;
}
public function invoke(Command $command): PdfId
{
$data = $this->dataProvider->provide($command->accountId());
$id = $this->pdfGenerator->generate(PDFTemplate::STATEMENT_OF_ACCOUNT, $data);
return $id;
}
}
final class ProducePaymentOverdueNoticeHandler
{
private $pdfGenerator;
private $dataProvider;
public function __construct(
PdfGenerator $pdfGenerator,
DefaultDataProvider $dataProvider
) {
$this->pdfGenerator = $pdfGenerator;
$this->dataProvider = $dataProvider;
}
public function invoke(Command $command): PdfId
{
$data = $this->dataProvider->provide($command->accountId());
$id = $this->pdfGenerator->generate(PDFTemplate::PAYMENT_OVERDUE, $data);
return $id;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment