|
12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
-
- namespace Lc\CaracoleBundle\Solver\Order;
-
- use Lc\CaracoleBundle\Model\Order\OrderProductReductionCatalogInterface;
-
- class OrderProductReductionCatalogSolver
- {
- // getSummaryOrderProductReductionCatalog
- public function getSummary(OrderProductReductionCatalogInterface $orderProductReductionCatalog): string
- {
- $text = '';
-
- if ($orderProductReductionCatalog->getUnit() == 'amount') {
- $text .= '- ' . $orderProductReductionCatalog->getValue() . ' €';
- }
-
- if ($orderProductReductionCatalog->getUnit() == 'percent') {
- $text .= '- ' . $orderProductReductionCatalog->getValue() . ' %';
- }
-
- return $text;
- }
-
- // compareOrderProductReductionCatalog
- public function compare(
- OrderProductReductionCatalogInterface $orderProductReductionCatalog,
- OrderProductReductionCatalogInterface $orderProductReductionCatalogCompare
- ): bool {
- return $orderProductReductionCatalogCompare
- && $orderProductReductionCatalog->getUnit() == $orderProductReductionCatalogCompare->getUnit()
- && (string)$orderProductReductionCatalog->getValue(
- ) == (string)$orderProductReductionCatalogCompare->getValue()
- && $orderProductReductionCatalog->getBehaviorTaxRate(
- ) == $orderProductReductionCatalogCompare->getBehaviorTaxRate();
- }
- }
|