1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright © O2TI. All rights reserved. |
4
|
|
|
* |
5
|
|
|
* @author Bruno Elisei <[email protected]> |
6
|
|
|
* See COPYING.txt for license details. |
7
|
|
|
*/ |
8
|
|
|
declare(strict_types=1); |
9
|
|
|
|
10
|
|
|
namespace O2TI\AutoCompleteAddressBr\Block\Customer; |
11
|
|
|
|
12
|
|
|
use Magento\Framework\App\Config\ScopeConfigInterface; |
13
|
|
|
use Magento\Framework\View\Element\Template; |
14
|
|
|
use Magento\Framework\View\Element\Template\Context; |
15
|
|
|
use Magento\Store\Model\ScopeInterface; |
16
|
|
|
use Magento\Store\Model\StoreManagerInterface; |
17
|
|
|
use O2TI\AutoCompleteAddressBr\Helper\Config; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Edit - Change Template Edit Account. |
21
|
|
|
*/ |
22
|
|
|
class Address extends Template |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @var Config |
26
|
|
|
*/ |
27
|
|
|
private $config; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var ScopeInterface |
31
|
|
|
*/ |
32
|
|
|
private $scopeConfig; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var StoreManagerInterface |
36
|
|
|
*/ |
37
|
|
|
private $storeManagerInterface; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param ScopeConfigInterface $scopeConfig |
41
|
|
|
* @param StoreManagerInterface $storeManagerInterface |
42
|
|
|
* @param Context $context |
43
|
|
|
* @param Config $config |
44
|
|
|
* @param array $data |
45
|
|
|
*/ |
46
|
|
|
public function __construct( |
47
|
|
|
ScopeConfigInterface $scopeConfig, |
48
|
|
|
StoreManagerInterface $storeManagerInterface, |
49
|
|
|
Context $context, |
50
|
|
|
Config $config, |
51
|
|
|
array $data = [] |
52
|
|
|
) { |
53
|
|
|
$this->scopeConfig = $scopeConfig; |
|
|
|
|
54
|
|
|
$this->storeManagerInterface = $storeManagerInterface; |
55
|
|
|
$this->config = $config; |
56
|
|
|
parent::__construct($context, $data); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Get Configs Module. |
61
|
|
|
* |
62
|
|
|
* @param string $field |
63
|
|
|
* |
64
|
|
|
* @return string |
65
|
|
|
*/ |
66
|
|
|
public function getConfigForModule(string $field): ?string |
67
|
|
|
{ |
68
|
|
|
$storeId = $this->storeManagerInterface->getStore()->getId(); |
69
|
|
|
$configPath = sprintf(Config::CONFIG_PATH_GENERAL, $field); |
70
|
|
|
|
71
|
|
|
return $this->scopeConfig->getValue($configPath, ScopeInterface::SCOPE_STORE, $storeId); |
|
|
|
|
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..