src/Invoice/Form/Dto/Factory/InvoiceDraftItemUpdateFormDtoFactory.php line 26

  1. <?php
  2. declare(strict_types=1);
  3. /**
  4.  * Copyright (c) 2020 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 2020 TECLA Consulting Group oü
  16.  */
  17. namespace App\Invoice\Form\Dto\Factory;
  18. use App\Invoice\Form\Dto\InvoiceDraftItemUpdateFormDto;
  19. use App\Invoice\Model\InvoiceDraftItemInterface;
  20. final class InvoiceDraftItemUpdateFormDtoFactory implements InvoiceDraftItemUpdateFormDtoFactoryInterface
  21. {
  22.     public function create(string $description null, ?int $quantity null, ?int $unitPrice null, ?int $vat null): InvoiceDraftItemUpdateFormDto
  23.     {
  24.         return new InvoiceDraftItemUpdateFormDto(
  25.             $description,
  26.             $quantity,
  27.             $unitPrice,
  28.             $vat
  29.         );
  30.     }
  31.     public function createFromInvoiceDraftItem(InvoiceDraftItemInterface $invoiceDraftItem): InvoiceDraftItemUpdateFormDto
  32.     {
  33.         return $this->create(
  34.             $invoiceDraftItem->getDescription(),
  35.             $invoiceDraftItem->getQuantity(),
  36.             $invoiceDraftItem->getUnitPrice(),
  37.             $invoiceDraftItem->getVat(),
  38.         );
  39.     }
  40. }