Skip to content

Commit

Permalink
Implement interface for price helper
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandoorn committed Jun 15, 2023
1 parent 7b8253c commit c3cfe25
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Helper/ProductVariantPriceHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Sylius\Component\Core\Calculator\ProductVariantPricesCalculatorInterface;
use Sylius\Component\Core\Model\ProductVariantInterface;

final class ProductVariantPriceHelper
final class ProductVariantPriceHelper implements ProductVariantPriceHelperInterface
{
private ProductVariantPricesCalculatorInterface $productVariantPricesCalculator;

Expand Down
14 changes: 14 additions & 0 deletions src/Helper/ProductVariantPriceHelperInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);

namespace StefanDoorn\SyliusGtmEnhancedEcommercePlugin\Helper;

use Sylius\Component\Core\Model\ProductVariantInterface;

interface ProductVariantPriceHelperInterface
{
public function getProductVariantPrice(
ProductVariantInterface $productVariant
): int;
}
6 changes: 3 additions & 3 deletions src/TagManager/ViewItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use StefanDoorn\SyliusGtmEnhancedEcommercePlugin\Helper\GoogleImplementationEnabled;
use StefanDoorn\SyliusGtmEnhancedEcommercePlugin\Helper\ProductIdentifierHelper;
use StefanDoorn\SyliusGtmEnhancedEcommercePlugin\Helper\ProductVariantPriceHelper;
use StefanDoorn\SyliusGtmEnhancedEcommercePlugin\Helper\ProductVariantPriceHelperInterface;
use Sylius\Component\Channel\Context\ChannelContextInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Model\TaxonInterface;
Expand All @@ -28,15 +28,15 @@ final class ViewItem implements ViewItemInterface

private GoogleImplementationEnabled $googleImplementationEnabled;

private ProductVariantPriceHelper $productVariantPriceHelper;
private ProductVariantPriceHelperInterface $productVariantPriceHelper;

public function __construct(
GoogleTagManagerInterface $googleTagManager,
ChannelContextInterface $channelContext,
CurrencyContextInterface $currencyContext,
ProductIdentifierHelper $productIdentifierHelper,
ProductVariantResolverInterface $productVariantResolver,
ProductVariantPriceHelper $productVariantPriceHelper,
ProductVariantPriceHelperInterface $productVariantPriceHelper,
GoogleImplementationEnabled $googleImplementationEnabled
) {
$this->googleTagManager = $googleTagManager;
Expand Down
6 changes: 3 additions & 3 deletions src/TagManager/ViewItemList.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Doctrine\Common\Collections\ArrayCollection;
use StefanDoorn\SyliusGtmEnhancedEcommercePlugin\Helper\GoogleImplementationEnabled;
use StefanDoorn\SyliusGtmEnhancedEcommercePlugin\Helper\ProductIdentifierHelper;
use StefanDoorn\SyliusGtmEnhancedEcommercePlugin\Helper\ProductVariantPriceHelper;
use StefanDoorn\SyliusGtmEnhancedEcommercePlugin\Helper\ProductVariantPriceHelperInterface;
use Sylius\Component\Channel\Context\ChannelContextInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Model\TaxonInterface;
Expand All @@ -32,7 +32,7 @@ final class ViewItemList implements ViewItemListInterface

private GoogleImplementationEnabled $googleImplementationEnabled;

private ProductVariantPriceHelper $productVariantPriceHelper;
private ProductVariantPriceHelperInterface $productVariantPriceHelper;

public function __construct(
GoogleTagManagerInterface $googleTagManager,
Expand All @@ -41,7 +41,7 @@ public function __construct(
LocaleContextInterface $localeContext,
ProductIdentifierHelper $productIdentifierHelper,
ProductVariantResolverInterface $productVariantResolver,
ProductVariantPriceHelper $productVariantPriceHelper,
ProductVariantPriceHelperInterface $productVariantPriceHelper,
GoogleImplementationEnabled $googleImplementationEnabled
) {
$this->googleTagManager = $googleTagManager;
Expand Down

0 comments on commit c3cfe25

Please sign in to comment.