src/Invoice/Model/Factory/InvoicePaymentNotificationFactory.php line 29

  1. <?php
  2. declare(strict_types=1);
  3. /**
  4.  * Copyright (c) 2022 TECLA Consulting Group oü.
  5.  * All rights reserved.
  6.  *
  7.  * This unpublished material is proprietary to TECLA Consulting Group oü.
  8.  * All rights reserved. The methods and
  9.  * techniques described herein are considered trade secrets
  10.  * and/or confidential. Reproduction or distribution, in whole
  11.  * or in part, is forbidden except by express written permission
  12.  * of TECLA Consulting Group oü.
  13.  *
  14.  * @author    Matúš Sýkorjak <matus@tecla.no>
  15.  * @copyright 2022 TECLA Consulting Group oü
  16.  */
  17. namespace App\Invoice\Model\Factory;
  18. use App\Contact\Model\ContactInterface;
  19. use App\Invoice\Dto\InvoicePaymentNotificationDto;
  20. use App\Invoice\Model\Identity\InvoicePaymentNotificationId;
  21. use App\Invoice\Model\InvoicePaymentNotification;
  22. use App\Invoice\Model\InvoicePaymentNotificationInterface;
  23. final class InvoicePaymentNotificationFactory implements InvoicePaymentNotificationFactoryInterface
  24. {
  25.     public function create(
  26.         ContactInterface $subscriber,
  27.         ContactInterface $supplier null,
  28.         ContactInterface $customer null
  29.     ): InvoicePaymentNotificationInterface {
  30.         return new InvoicePaymentNotification(
  31.             InvoicePaymentNotificationId::create(),
  32.             $subscriber,
  33.             $supplier,
  34.             $customer
  35.         );
  36.     }
  37.     public function createFromDto(InvoicePaymentNotificationDto $dto): InvoicePaymentNotificationInterface
  38.     {
  39.         return $this->create(
  40.             $dto->getSubscriber(),
  41.             $dto->getSupplier(),
  42.             $dto->getCustomer()
  43.         );
  44.     }
  45. }