CarrierConfig.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Ups\Block\Backend\System;
  7. use Magento\Backend\Block\Template;
  8. use Magento\Backend\Block\Template\Context as TemplateContext;
  9. use Magento\Store\Model\Website;
  10. use Magento\Ups\Helper\Config as ConfigHelper;
  11. /**
  12. * Backend shipping UPS content block
  13. *
  14. * @api
  15. * @since 100.0.2
  16. */
  17. class CarrierConfig extends Template
  18. {
  19. /**
  20. * Shipping carrier config
  21. *
  22. * @var \Magento\Ups\Helper\Config
  23. */
  24. protected $carrierConfig;
  25. /**
  26. * @var \Magento\Store\Model\Website
  27. */
  28. protected $_websiteModel;
  29. /**
  30. * @param \Magento\Backend\Block\Template\Context $context
  31. * @param \Magento\Ups\Helper\Config $carrierConfig
  32. * @param \Magento\Store\Model\Website $websiteModel
  33. * @param array $data
  34. */
  35. public function __construct(
  36. TemplateContext $context,
  37. ConfigHelper $carrierConfig,
  38. Website $websiteModel,
  39. array $data = []
  40. ) {
  41. $this->carrierConfig = $carrierConfig;
  42. $this->_websiteModel = $websiteModel;
  43. parent::__construct($context, $data);
  44. }
  45. /**
  46. * Get shipping model
  47. *
  48. * @return \Magento\Ups\Helper\Config
  49. */
  50. public function getCarrierConfig()
  51. {
  52. return $this->carrierConfig;
  53. }
  54. /**
  55. * Get website model
  56. *
  57. * @return \Magento\Store\Model\Website
  58. */
  59. public function getWebsiteModel()
  60. {
  61. return $this->_websiteModel;
  62. }
  63. /**
  64. * Get store config
  65. *
  66. * @param string $path
  67. * @param mixed $store
  68. * @return mixed
  69. */
  70. public function getConfig($path, $store = null)
  71. {
  72. return $this->_scopeConfig->getValue($path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $store);
  73. }
  74. }