ItemCode.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * @copyright Vertex. All rights reserved. https://www.vertexinc.com/
  4. * @author Mediotype https://www.mediotype.com/
  5. */
  6. namespace Vertex\Tax\Model;
  7. use Magento\GiftWrapping\Model\Total\Quote\Tax\Giftwrapping;
  8. /**
  9. * Retrieve special item codes
  10. */
  11. class ItemCode
  12. {
  13. /** @var ModuleManager */
  14. private $moduleManager;
  15. /**
  16. * @param ModuleManager $moduleManager
  17. */
  18. public function __construct(ModuleManager $moduleManager)
  19. {
  20. $this->moduleManager = $moduleManager;
  21. }
  22. /**
  23. * Determine if the Giftwrapping module is enabled
  24. *
  25. * @return bool
  26. */
  27. private function isGiftWrappingEnabled()
  28. {
  29. return $this->moduleManager->isEnabled('Magento_GiftWrapping');
  30. }
  31. /**
  32. * Get the Giftwrapping Code
  33. *
  34. * @return bool|string
  35. */
  36. public function giftWrap()
  37. {
  38. return $this->isGiftWrappingEnabled() ? Giftwrapping::CODE_QUOTE_GW : false;
  39. }
  40. /**
  41. * Get the Printed Card code
  42. *
  43. * @return bool|string
  44. */
  45. public function printedCard()
  46. {
  47. return $this->isGiftWrappingEnabled() ? Giftwrapping::CODE_PRINTED_CARD : false;
  48. }
  49. }