Shipping.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Dhl\Model\Plugin\Checkout\Block\Cart;
  7. /**
  8. * Checkout cart shipping block plugin
  9. */
  10. class Shipping
  11. {
  12. /**
  13. * @var \Magento\Framework\App\Config\ScopeConfigInterface
  14. */
  15. protected $_scopeConfig;
  16. /**
  17. * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
  18. */
  19. public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig)
  20. {
  21. $this->_scopeConfig = $scopeConfig;
  22. }
  23. /**
  24. * @param \Magento\Checkout\Block\Cart\LayoutProcessor $subject
  25. * @param bool $result
  26. * @return bool
  27. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  28. */
  29. public function afterIsStateActive(\Magento\Checkout\Block\Cart\LayoutProcessor $subject, $result)
  30. {
  31. return (bool)$result || (bool)$this->_scopeConfig->getValue(
  32. 'carriers/dhl/active',
  33. \Magento\Store\Model\ScopeInterface::SCOPE_STORE
  34. );
  35. }
  36. /**
  37. * @param \Magento\Checkout\Block\Cart\LayoutProcessor $subject
  38. * @param bool $result
  39. * @return bool
  40. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  41. */
  42. public function afterIsCityActive(\Magento\Checkout\Block\Cart\LayoutProcessor $subject, $result)
  43. {
  44. return (bool)$result || (bool)$this->_scopeConfig->getValue(
  45. 'carriers/dhl/active',
  46. \Magento\Store\Model\ScopeInterface::SCOPE_STORE
  47. );
  48. }
  49. }