SHARE
TWEET

Untitled

a guest Sep 20th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. final class ProduceAccountStatementHandler
  4. {
  5.   private $accountFinder;
  6.   private $pdfGenerator;
  7.   private $accountTotalCalculator;
  8.  
  9.   public function __construct(
  10.     AccountFinder $accountFinder,
  11.     PdfGenerator $pdfGenerator,
  12.     AccountTotalCalculator $accountTotalCalculator
  13.   ) {
  14.     $this->accountFinder = $accountFinder;
  15.     $this->pdfGenerator = $pdfGenerator;
  16.     $this->accountTotalCalculator = $accountTotalCalculator;
  17.   }
  18.  
  19.   public function handle(Command $command): void
  20.   {
  21.     $account = $this->accountFinder->byId($command->accountId());
  22.     $accountTotal = $this->accountTotalCalculator->calculate($account);
  23.     $this->pdfGenerator->generate('account-statement.template', $account, $accountTotal);
  24.   }
  25. }
  26.  
  27. final class ProducePaymentOverdueNoticeHandler
  28. {
  29.   private $accountFinder;
  30.   private $pdfGenerator;
  31.   private $accountTotalCalculator;
  32.  
  33.   public function __construct(
  34.     AccountFinder $accountFinder,
  35.     PdfGenerator $pdfGenerator,
  36.     AccountTotalCalculator $accountTotalCalculator
  37.   ) {
  38.     $this->accountFinder = $accountFinder;
  39.     $this->pdfGenerator = $pdfGenerator;
  40.     $this->accountTotalCalculator = $accountTotalCalculator;
  41.   }
  42.  
  43.   public function handle(Command $command): void
  44.   {
  45.     $account = $this->accountFinder->byId($command->accountId());
  46.     $accountTotal = $this->accountTotalCalculator->calculate($account);
  47.     $this->pdfGenerator->generate('payment-overdue-notice.template', $account, $accountTotal);
  48.   }
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top