Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

OrderProductReductionCatalogSolver.php 1.4KB

před 3 roky
před 3 roky
12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace Lc\CaracoleBundle\Solver\Order;
  3. use Lc\CaracoleBundle\Model\Order\OrderProductReductionCatalogInterface;
  4. class OrderProductReductionCatalogSolver
  5. {
  6. // getSummaryOrderProductReductionCatalog
  7. public function getSummary(OrderProductReductionCatalogInterface $orderProductReductionCatalog): string
  8. {
  9. $text = '';
  10. if ($orderProductReductionCatalog->getUnit() == 'amount') {
  11. $text .= '- ' . $orderProductReductionCatalog->getValue() . '&nbsp;€';
  12. }
  13. if ($orderProductReductionCatalog->getUnit() == 'percent') {
  14. $text .= '- ' . $orderProductReductionCatalog->getValue() . '&nbsp;%';
  15. }
  16. return $text;
  17. }
  18. // compareOrderProductReductionCatalog
  19. public function compare(
  20. OrderProductReductionCatalogInterface $orderProductReductionCatalog,
  21. OrderProductReductionCatalogInterface $orderProductReductionCatalogCompare
  22. ): bool {
  23. return $orderProductReductionCatalogCompare
  24. && $orderProductReductionCatalog->getUnit() == $orderProductReductionCatalogCompare->getUnit()
  25. && (string)$orderProductReductionCatalog->getValue(
  26. ) == (string)$orderProductReductionCatalogCompare->getValue()
  27. && $orderProductReductionCatalog->getBehaviorTaxRate(
  28. ) == $orderProductReductionCatalogCompare->getBehaviorTaxRate();
  29. }
  30. }