Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Config.php
Go to the documentation of this file.
1 <?php
7 
11 
15 class Config
16 {
17  const ACTIVE = 'sales/instant_purchase/active';
18  const BUTTON_TEXT = 'sales/instant_purchase/button_text';
19 
23  private $scopeConfig;
24 
29  public function __construct(
30  ScopeConfigInterface $scopeConfig
31  ) {
32  $this->scopeConfig = $scopeConfig;
33  }
34 
41  public function isModuleEnabled(int $storeId): bool
42  {
43  return $this->isSetFlag(self::ACTIVE, $storeId);
44  }
45 
52  public function getButtonText(int $storeId): string
53  {
54  return $this->getValue(self::BUTTON_TEXT, $storeId);
55  }
56 
64  private function getValue(string $path, int $storeId)
65  {
66  return $this->scopeConfig->getValue(
67  $path,
69  $storeId
70  );
71  }
72 
80  private function isSetFlag(string $path, int $storeId): bool
81  {
82  return $this->scopeConfig->isSetFlag(
83  $path,
85  $storeId
86  );
87  }
88 }
__construct(ScopeConfigInterface $scopeConfig)
Definition: Config.php:29