Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

OrderProductReductionCatalogSolver.php 1.3KB

3 anos atrás
3 anos atrás
123456789101112131415161718192021222324252627282930313233343536
  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 $orderProductReductionCatalog->getUnit() == $orderProductReductionCatalogCompare->getUnit()
  24. && (string)$orderProductReductionCatalog->getValue(
  25. ) == (string)$orderProductReductionCatalogCompare->getValue()
  26. && $orderProductReductionCatalog->getBehaviorTaxRate(
  27. ) == $orderProductReductionCatalogCompare->getBehaviorTaxRate();
  28. }
  29. }